Question

I have a document library with subfolders containing images. I'd like to traverse the subfolders and grab the URLs of those images so that I can display them on my little js web app I'm whipping up.

I can only seem to get the root of the document library using SPServices' GetListItems. I've tried passing in "library/subfolder" as the list name, but that didn't work.

Is there a way to do this?

Was it helpful?

Solution

You'll want to add a CAMLQuery option to your GetListItems call:

CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope="Recursive"/></QueryOptions>",

This will result in the recursive querying of all the subfolders.

OTHER TIPS

The best would be to use SPQuery to get your items, but use the Folder property on each list item (starting from Root folder) and check for "null" (this will tell you if you hit a folder or a simple item). Alternative, use same SPQuery but rely on content type query meaning "Get all items of a certain Content Type" and use FOLDER as the query.

Exact example have a look here http://avinashkt.blogspot.com/2010/03/spfolder-related-operations-in.html

Hope it helps, C:\Marius

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top