tags:

views:

29

answers:

2

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.

+1  A: 

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.

F.Aquino
Thanks for your reply. But I only use the ObjectModel. No page and script got involved. Is there a way to get the selected pictures for the current login?
albertg
Then I guess your question scope is limited to the sharepoint SDK, in which I don't think there's a way. Why would the page object (postback and request.form) be ruled out?
F.Aquino
+1  A: 

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

Sachin
I tried SPPictureLibrary.GetItems(Views["Selected Pictures"]), but all pictures were returned.
albertg
I am unable to try the code now. Will get back on this later if I find a solution.
Sachin