SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a photo gallery library. I want to get all albums and their images. Now I get all albums (root level items) with something like this:

ClientContext ctx = new ClientContext(_url);
_mylib = web.Lists.GetByTitle("mylib");
_albums = _list.GetItems(new CamlQuery());

_albums represents albums, on the root of the gallery. How do I get files/items in each of these albums?

share|improve this question

I did something very similar to this recently (Picture Libraries, Client object model, silverlight).

What I did different was each "album" was in it's own Picture Library.

When I give the user the option to select an album, I gather a ListCollection of lists where the BaseType is that of a Picture Library (can't remember the exact number now, search around for it though) - and put this list into a DropdownList.

Stick an event handler onto the DropdownList such that when it's changed, the selected item is pulled out, put into a CAML Query which loads all items from a specified list (by GUID).

In short? Avoid folders, use separate lists/libraries instead. If you must keep them in the same library, then add a column to store an "Album Name". Then do a CAML Query to filter based on a value in this column, this will return all files in a specific "album".

share|improve this answer
I managed to get all albums + images using Folder and Folder.Files in them. The only problem now is that I must test it at work. I will accept you answer if no better comes, because it's one of the solutions to the problem. – Andrej Cimperšek Feb 7 '11 at 17:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.