SharePoint Webservice SOAP Call for “recently changed items”

I just read a tweet question: @robertkuzma do you know syntax for web service call to get “recently changed items” from share point?

The important thing here is to properly create the XML you are posting. The article Writing CAML Queries For Retrieving List Items from a SharePoint List might be usefull to construct the SOAP call needed.

Check out the code below – will get you the items modified in last 3 days:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <listName>yourListNameHere</listName>
            <query>
                <Query>
                    <Where>
                        <Geq>
                            <FieldRef Name="Modified" />
                            <Value Type="DateTime"><Today OffsetDays="-3" /></Value>
                        </Geq>
                    </Where>
                </Query>
            </query>
        </GetListItems>
    </soap:Body>
</soap:Envelope>

Don’t forget to add SOAPAction = “http://schemas.microsoft.com/sharepoint/soap/GetListItems” to the header of your POST SOAP call.