SharePoint REST API - 同步SharePoint列表項
部落格地址:http://blog.csdn.net/FoxDave
本篇只講REST服務中的GetListItemChangesSinceToken這個東西。何謂同步呢,你也可以理解為增量變化,即給定一個時間,我需要獲取從那個時間到現在所有發生變化的列表項。
使用GetListItemChangesSinceToken同步SharePoint列表項
如果你想要在SharePoint和你的Add-in或服務之間同步列表項,可以使用GetListItemChangesSinceToken來達到目的,它跟SharePoint Web服務請求中的List.GetListItemChangesSinceToken是對應的。
在POST請求的body中加入SP.ChangeLogItemQuery物件的屬性。該請求會返回ADO行集合的XML,包含了符合查詢條件的列表項的更改記錄。
示例請求如下:
請求的URL
POST http://server/site/_api/web/Lists/GetByTitle('Announcements')/GetListItemChangesSinceToken
請求的Body
{ 'd' : {
'query': {
'__metadata': { 'type': 'SP.ChangeLogItemQuery'},
'ViewName': '',
'Query': '<Where>
<Contains>
<FieldRef Name="Title" />
<Value Type='Text'>Te</Value>
</Contains></Where>',
'QueryOptions': '<QueryOptions>
<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>
<DateInUtc>False</DateInUtc>
<IncludePermissions>TRUE</IncludePermissions>
<IncludeAttachmentUrls>FALSE</IncludeAttachmentUrls>
<Folder>Shared Documents/Test1</Folder></QueryOptions>',
'ChangeToken':'1;3;eee4c6d5-f88a-42c4-8ce1-685122984870;634397182229400000;3710',
'Contains':'<Contains>
<FieldRef Name="Title"/>
<Value Type="Text">Testing</Value></Contains>' }
}
}
SP.ChangeLogItemQuery物件屬性
Property | Description |
---|---|
ListName | 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. |
ViewName | 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 a value of 1000, then 1,000 rows are returned in the response. |
Query | A Query element containing the query that determines which records are returned and in what order. |
QueryOptions | An XML fragment in the following form that contains separate nodes for the various properties of the SPQuery object. |
ChangeToken | A string that contains the change token for the request. For a description of the format that is used in this string, see Overview of the Change Log. If null is passed, all items in the list are returned. |
Contains | A Contains element that defines custom filtering for the query. |
本篇就介紹到這裡。
相關文章
- 利用SSIS進行SharePoint 列表資料的ETL
- SharePoint詞彙表
- 全新的SharePoint 2019
- SharePoint 2019 圖文安裝教程
- sharepoint 2013 網站集解鎖網站
- Sharepoint安裝SSL證書?
- SharePoint 2016 圖文安裝教程
- SharePoint 特殊使用者標識
- Sharepoint模態窗體(實戰)
- SharePoint佈局頁建立(實戰)
- SharePoint程式碼建表(實戰)
- SharePoint佈局頁引用(實戰)
- SharePoint 2013 workflows stop working (Failed on started.)AI
- SharePoint Online 自定義Modern UI表單UI
- Sharepoint 開啟發布功能的PowerShell
- 現代化SharePoint經典網站網站
- SharePoint Online 為Modern Page新增指令碼指令碼
- SharePoint 2019 離線安裝準備工具
- 微軟Sharepoint的一些缺點微軟
- SharePoint Online 認證Net客戶端物件客戶端物件
- 如何改善SQL Server + SharePoint組合效能BGSQLServer
- 使用檢視格式化來自定義SharePoint
- SharePoint JavaScript 更新使用者和組欄位JavaScript
- 現代化SharePoint網站使用者介面網站
- SharePoint Online 觸發 Outlook 郵件內審批
- SharePoint 多行文字欄位設定預設值
- Sharepoint 2013搜尋服務配置總結(實戰)
- HTML頁面轉換為Sharepoint母版頁(實戰)HTML
- 使用欄位格式化來自定義SharePoint(八)
- 使用欄位格式化來自定義SharePoint(七)
- 使用欄位格式化來自定義SharePoint(四)
- 使用欄位格式化來自定義SharePoint(二)
- 使用欄位格式化來自定義SharePoint(五)
- 使用欄位格式化來自定義SharePoint(一)
- 使用欄位格式化來自定義SharePoint(六)
- 使用欄位格式化來自定義SharePoint(三)
- Granting and Managing Item Level Permission using SharePoint2013 Designer Workflow
- SharePoint中你不知道的圖片庫(實戰)
- 修改SharePoint上傳檔案大小限制(Changing Maximum Upload Size)