2

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?

1 Answer 1

3

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

<Folder>Lists/MyList/Admin</Folder>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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