Lists.GetListItemChangesSinceToken method

Returns changes made to the list since the date and time specified in the token.

Namespace:  WebSvcLists
Assembly:  STSSOAP (in STSSOAP.dll)

[SoapDocumentMethodAttribute("", RequestNamespace = "", 
	ResponseNamespace = "", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetListItemChangesSinceToken(
	string listName,
	string viewName,
	XmlNode query,
	XmlNode viewFields,
	string rowLimit,
	XmlNode queryOptions,
	string changeToken,
	XmlNode contains


Type: System.String

A string that contains either the title or the GUID for the list. When querying the UserInfo table, the string contains UserInfo. Using the GUID results in better performance.

Type: System.String

A string that contains the GUID for the view, which determines the view to use for the default view attributes represented by the query, viewFields, and rowLimit parameters. If this argument is not supplied, the default view is assumed. If it is supplied, the value of the query, viewFields, or rowLimit parameter overrides the equivalent setting within the view. For example, if the view specified by the viewFields parameter has a row limit of 100 rows but the rowLimit parameter contains 1000, then 1,000 rows are returned in the response.

Type: System.Xml.XmlNode

A Query element containing the query that determines which records are returned and in what order, and that can be assigned to a System.Xml.XmlNode object, as in the following example.

Type: System.Xml.XmlNode

A ViewFields element that specifies which fields to return in the query and in what order, and that can be assigned to a System.Xml.XmlNode object, as in the following example.

Type: System.String

A string that specifies the number of items, or rows, to display on a page before paging begins. If supplied, the value of this parameter overrides the row limit set in the view specified by the viewName parameter or the row limit set in the default view for the list.

Type: System.Xml.XmlNode

An XML fragment in the following form that contains separate nodes for the various properties of the SPQuery object, and that can be assigned to a System.Xml.XmlNode object.

Type: System.String

A string that contains the change token for the request. For a description of the format that is used in this string, see Overview: Change Tokens, Object Types, and Change Types. If a null reference (Nothing in Visual Basic) is passed, all items in the list are returned.

Type: System.Xml.XmlNode

A Contains element that defines custom filtering for the query and that can be assigned to a System.Xml.XmlNode object, as in the following example.

Return value

Type: System.Xml.XmlNode
An XML fragment in the following form that returns the last change token and item changes and that can be assigned to a System.Xml.XmlNode object:
<listitems MinTimeBetweenSyncs="0" RecommendedTimeBetweenSyncs="180" MaxBulkDocumentSyncSize="500" 
   AlternateUrls="http://MyServer/,http://zinzinzin/" EffectivePermMask="FullMask" 
   xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 
   xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" 
   <Changes LastChangeToken="1;3;b0c07dce-e4c7-45a9-8b7f-0d5339f69633;633247934080930000;70853">
   <rs:data ItemCount="2">
      <z:row ows_Attachments="0" ows_LinkTitle="MyItem1" ows_MetaInfo="3;#" ows__ModerationStatus="0" 
         ows__Level="1" ows_Title="MyItem1" ows_ID="3" ows_owshiddenversion="2" 
         ows_UniqueId="3;#{9153FDD3-7C00-47E9-9194-956BB20AAA8D}" ows_FSObjType="3;#0" 
         ows_Created_x0020_Date="3;#2007-08-31T21:34:59Z" ows_Created="2007-08-31T21:34:59Z" 
         ows_FileLeafRef="3;#3_.000" ows_FileRef="3;#sites/MyWebSite/Lists/MyList/3_.000" 
         ows_ServerRedirected="0" />
      <z:row ows_Attachments="0" ows_LinkTitle="MyItem2" ows_MetaInfo="5;#" ows__ModerationStatus="0" 
         ows__Level="1" ows_Title="MyItem2" ows_ID="5" ows_owshiddenversion="3" 
         ows_UniqueId="5;#{5BDBB1C0-194D-4878-B716-E397B0C1318C}" ows_FSObjType="5;#0" 
         ows_Created_x0020_Date="5;#2007-08-31T21:43:23Z" ows_Created="2007-08-31T21:43:23Z" 
         ows_FileLeafRef="5;#5_.000" ows_FileRef="5;#sites/MyWebSite/Lists/MyList/5_.000" 
         ows_ServerRedirected="0" />

The following table describes the return parameters.




Represents the minimum amount of time between user-initiated or automatic synchronization. The value represents a time in minutes.


Clients should respect this value even if the user initiates synchronization manually. That is, if this is set to 5 minutes, clients should only send one request per 5 minutes even if the user repeatedly clicks "send/receive".


Represents the recommended minimum amount of time between synchronizations. This should specifically be respected for automatic syncs. Clients should never automatically synchronize more often than this. User-initiated synchronizations can override this interval.


The total size of content to be synchronized to the client. The default is 500 MB. You get the URL and metadata for each document when you call GetListItemChangesSinceToken, but you then need to do an HTTP GET to retrieve the actual document contents. Setting this value to high may degrade performance.


Alternate URLs are listed in the following zone order, delimited by commas: Intranet,Default,Extranet,Internet,Custom


The permissions on the list as returned by SPList.EffectiveBasePermissions.ToString().

The following code example uses the GetListItemChangesSinceToken method to display the current change token that results each time after subsequent updates to a list.

Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
listService.Url = "http://MyServer/MyWebSite/_vti_bin/Lists.asmx";

XmlNode getListName = listService.GetList("MyCalendar");
string listName = getListName.Attributes["Name"].Value;

XmlNode getFirstToken = listService.GetListItemChangesSinceToken(listName, null, null, null, null, null, null, null);
string currentToken = getFirstToken.ChildNodes[1].Attributes["LastChangeToken"].Value;

label1.Text = currentToken + "\n";

string strEditItemTitle = "My New Title";
string strBatchEdit = "<Batch OnError='Continue'><Method ID='0' Cmd='Update'>" +
    "<Field Name='Title'>" + strEditItemTitle + "</Field>" +
    "<Field Name='ID'>2</Field>" +
    "<Field Name='EventDate'>2007-10-11T14:00:00Z</Field>" +
    "<Field Name='EndDate'>2007-10-12T14:00:00Z</Field>" +

XmlDocument doc = new System.Xml.XmlDocument();
XmlNode editUpdates = doc.DocumentElement;

    listService.UpdateListItems(listName, editUpdates);
catch (System.Web.Services.Protocols.SoapException ex1)
    MessageBox.Show(ex1.Message + "\n" + ex1.Detail.InnerText + "\n" + ex1.StackTrace);

XmlNode getSecondToken = listService.GetListItemChangesSinceToken(listName, null, null, null, null, null, currentToken, null);

currentToken = getSecondToken.ChildNodes[1].Attributes["LastChangeToken"].Value;
label1.Text += currentToken + "\n";

string strNewItemTitle = "My New Item";

string strBatchNew = "<Batch OnError='Continue'><Method ID='0' Cmd='New'>" +
    "<Field Name='ID'>New</Field>" +
    "<Field Name='Title'>" + strNewItemTitle + "</Field>" +
    "<Field Name='EventDate'>2007-10-2T14:00:00Z</Field>" +
    "<Field Name='EndDate'>2007-10-3T14:00:00Z</Field>" +

doc = new System.Xml.XmlDocument();
XmlNode addUpdates = doc.DocumentElement;

    listService.UpdateListItems(listName, addUpdates);
catch (System.Web.Services.Protocols.SoapException ex2)
    MessageBox.Show(ex2.Message + "\n" + ex2.Detail.InnerText + "\n" + ex2.StackTrace);

XmlNode getThirdToken = listService.GetListItemChangesSinceToken(listName, null, null, null, null, null, currentToken, null);

currentToken = getThirdToken.ChildNodes[1].Attributes["LastChangeToken"].Value;
label1.Text += currentToken;