Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to call the Lists.asmx webservice to retrieve only those items within a Folder named "Admin" in my SharePoint list. The webservice 'works' for me to some degree, but not as I expect.

The below soap returns only the items in the root folder, as expected.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"
                      xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <listName>{FBFB9086-58A5-4BFE-BAEC-615085147059}</listName>
            <viewName/>
            <rowLimit>1000</rowLimit>
            <webID/>
        </GetListItems>
    </s:Body>
</s:Envelope>

I found the QueryOptions parameter in the proxy which injects a node into the soap request, as below:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"
                      xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <listName>{FBFB9086-58A5-4BFE-BAEC-615085147059}</listName>
            <viewName/>
            <rowLimit>1000</rowLimit>
            <queryOptions>
                <QueryOptions xmlns="">
                    <Folder>Admin</Folder>
                </QueryOptions>
            </queryOptions>
            <webID/>
        </GetListItems>
    </s:Body>
</s:Envelope>

Instead of returning only those items in the "Admin" Folder, or even including those items, this request actually returns all items in all folders and subfolders with a recursive listing. This meets my need by returning the "Admin" items, but it is less than ideal because there are a large number of items.

Am I calling the webservice incorrectly?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The <Folder> element should contain the full folder name including the RootFolder so it should be something like:

<Folder>Lists/MyList/Admin</Folder>
share|improve this answer
    
That was all it took, thanks. –  Kirk Broadhurst Apr 30 '12 at 2:42
add comment

Your Answer

 
discard

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.