Lists.GetListItemChangesSinceToken method
傳回日期自清單所做的變更和權杖中所指定的時間。
Namespace: WebSvcLists
Assembly: STSSOAP (in STSSOAP.dll)
Syntax
'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetListItemChangesSinceToken", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetListItemChangesSinceToken ( _
listName As String, _
viewName As String, _
query As XmlNode, _
viewFields As XmlNode, _
rowLimit As String, _
queryOptions As XmlNode, _
changeToken As String, _
contains As XmlNode _
) As XmlNode
'用途
Dim instance As Lists
Dim listName As String
Dim viewName As String
Dim query As XmlNode
Dim viewFields As XmlNode
Dim rowLimit As String
Dim queryOptions As XmlNode
Dim changeToken As String
Dim contains As XmlNode
Dim returnValue As XmlNode
returnValue = instance.GetListItemChangesSinceToken(listName, _
viewName, query, viewFields, rowLimit, _
queryOptions, changeToken, contains)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetListItemChangesSinceToken", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
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
)
參數
listName
Type: System.String字串,包含標題或清單的 GUID。查詢的使用者資訊資料表時, 的字串,包含UserInfo。使用 GUID 結果中較佳的效能。
viewName
Type: System.String字串,其中含有檢視中,會決定要使用的預設檢視屬性的檢視 GUID query、 viewFields和表示rowLimit參數。若未提供此引數,會假設為預設檢視。若提供, query、 viewFields或rowLimit參數的值會覆寫檢視中的對等設定。例如,如果viewFields參數所指定的檢視有 100 個資料列的列數限制,但rowLimit參數包含 1000年,若有 1000 列會傳回以回應。
query
Type: System.Xml.XmlNode包含查詢,以決定哪一筆記錄會傳回,並在新的查詢元素順序,而且可以指派給System.Xml.XmlNode物件,如下列範例所示。
viewFields
Type: System.Xml.XmlNodeA 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.
rowLimit
Type: System.StringA 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.
queryOptions
Type: System.Xml.XmlNodeAn 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.
changeToken
Type: System.StringA 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.
contains
Type: System.Xml.XmlNodeA 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.
傳回值
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"
xmlns="https://schemas.microsoft.com/sharepoint/soap/">
<Changes LastChangeToken="1;3;b0c07dce-e4c7-45a9-8b7f-0d5339f69633;633247934080930000;70853">
</Changes>
<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" />
...
</rs:data>
</listitems>
備註
The following table describes the return parameters.
屬性 |
定義 |
||
---|---|---|---|
MinTimeBetweenSyncs |
Represents the minimum amount of time between user-initiated or automatic synchronization. The value represents a time in minutes.
|
||
RecommendedTimeBetweenSyncs |
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. |
||
MaxBulkDocumentSyncSize |
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. |
||
AlternateUrls |
Alternate URLs are listed in the following zone order, delimited by commas: Intranet,Default,Extranet,Internet,Custom |
||
EffectiveBasePermissions |
The permissions on the list as returned by SPList.EffectiveBasePermissions.ToString(). |
Examples
The following code example uses the GetListItemChangesSinceToken method to display the current change token that results each time after subsequent updates to a list.
Dim listService As New Web_Reference_Folder.Lists()
listService.Credentials = System.Net.CredentialCache.DefaultCredentials
listService.Url = "http://MyServer/MyWebSite/_vti_bin/Lists.asmx"
Dim getListName As XmlNode = listService.GetList("MyCalendar")
Dim listName As String = getListName.Attributes("Name").Value
Dim getFirstToken As XmlNode = listService.GetListItemChangesSinceToken(listName, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)
Dim currentToken As String = getFirstToken.ChildNodes(1).Attributes("LastChangeToken").Value
label1.Text = currentToken + ControlChars.Lf
Dim strEditItemTitle As String = "My New Title"
Dim strBatchEdit As String = "<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>" +
"</Method></Batch>"
Dim doc = New System.Xml.XmlDocument()
doc.LoadXml(strBatchEdit)
Dim editUpdates As XmlNode = doc.DocumentElement
Try
listService.UpdateListItems(listName, editUpdates)
Catch ex1 As System.Web.Services.Protocols.SoapException
MessageBox.Show((ex1.Message + ControlChars.Lf + ex1.Detail.InnerText + ControlChars.Lf + ex1.StackTrace))
End Try
Dim getSecondToken As XmlNode = listService.GetListItemChangesSinceToken(listName, Nothing, Nothing, Nothing, Nothing, Nothing, currentToken, Nothing)
currentToken = getSecondToken.ChildNodes(1).Attributes("LastChangeToken").Value
label1.Text += currentToken + ControlChars.Lf
Dim strNewItemTitle As String = "My New Item"
Dim strBatchNew As String = "<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>" +
"</Method></Batch>"
doc = New System.Xml.XmlDocument()
doc.LoadXml(strBatchNew)
Dim addUpdates As XmlNode = doc.DocumentElement
Try
listService.UpdateListItems(listName, addUpdates)
Catch ex2 As System.Web.Services.Protocols.SoapException
MessageBox.Show((ex2.Message + ControlChars.Lf + ex2.Detail.InnerText + ControlChars.Lf + ex2.StackTrace))
End Try
Dim getThirdToken As XmlNode = listService.GetListItemChangesSinceToken(listName, Nothing, Nothing, Nothing, Nothing, Nothing, currentToken, Nothing)
currentToken = getThirdToken.ChildNodes(1).Attributes("LastChangeToken").Value
label1.Text += currentToken
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>" +
"</Method></Batch>";
XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(strBatchEdit);
XmlNode editUpdates = doc.DocumentElement;
try
{
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>" +
"</Method></Batch>";
doc = new System.Xml.XmlDocument();
doc.LoadXml(strBatchNew);
XmlNode addUpdates = doc.DocumentElement;
try
{
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;