SharePoint web service call to retrieve file information for the contents of a specific SPFolder

1.1k views Asked by At

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?

1

There are 1 answers

0
EvgK On BEST ANSWER

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.