Question

I have a large SharePoint document library with many levels of subfolders in it, my goal is to make one service call to list the file information (Name, size, AbsoluteUrl, etc.) of the files contained in that specific folder without enumerating through all of them.

The client application I'm writing will always have the path of the folder (ex: DocLibraryName\Folder\SubFolder1). I cannot use the SharePoint API access the data, I'm forced to use the Lists.asmx, dws.asmx, etc.. services built into MOSS 2007. My client app is in C# .Net 4.

It seems like I should be using the Lists.GetListItems method, if that is the case, what is the CAML query for just hitting a specific folder?

Was it helpful?

Solution

You can use the code like this:

XmlDocument document = new XmlDocument();
XmlElement queryOptions = document.CreateElement("QueryOptions");
queryOptions.InnerXml = @"<Folder>DocLibraryName\Folder\SubFolder1</Folder>";

and pass it as queryOptions element of Lists.GetListItems call.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top