albertg
albertg

Reputation: 21

How to get the selected pictures in a picture library in SharePoint

Is there a way to get the selected pictures in a picture library with the object model in SharePoint? It seems there is not a selected flag with each picture item in the library.

Upvotes: 2

Views: 1149

Answers (2)

Sachin
Sachin

Reputation: 876

SPPictureLibrary pictureLibrary = (SPPictureLibrary)web.Lists[""].Views["Selected"]

Upvotes: 2

Francisco Aquino
Francisco Aquino

Reputation: 9117

I would first ask when you want to select the pictures? There is a button on your library that triggers a postback? If yes, you can use javascript (or something smarter, jquery) to grab all selected IDs (the IDs should have to be visible in the view) or try to grab it by the request.form sent during the postback.

This is related to the page state, the ListItems would have carry such information (selected) because it happens differently for every user.

Upvotes: 1

Related Questions