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. |
SharePoint REST API - 同步SharePoint列表项的更多相关文章
- SharePoint 2013 自定义翻页显示列表项
项目需求:自定义开发一个能分页显示列表项的小部件,允许左右翻页,能根据用户权限来显示管理链接等. 效果如下: 技术要求:使用sharepoint rest API 来获取列表项,这样性能高,能够快速响 ...
- How to Call SharePoint 2013 API Service to Query The Lists
How to Call SharePoint 2013 API In SharePoint 2013, we can query the list by it owner service, then ...
- SharePoint REST API - 列表和列表项
博客地址:http://blog.csdn.net/FoxDave 本篇主要讲述如何用SharePoint REST操作列表和列表项.阅读本篇时请先了解前面讲述的REST介绍和基本操作. 废话不多 ...
- 复制SharePoint列表项(SPListItem)到另一个列表
从理论上讲,有一个简单到难以置信的解决办法:SPListItem提供了一个CopyTo(destinationUrl)方法(可参考MSDN).不幸的是,这个方法似乎用不了.至少对我的情况(一个带附件的 ...
- 每日学习心得:SharePoint 2013 自定义列表项添加Callout菜单项、文档关注、SharePoint服务端对象模型查询
前言: 前一段时间一直都比较忙,没有什么时间进行总结,刚好节前项目上线,同时趁着放假可以好好的对之前遇到的一些问题进行总结.主要内容有使用SharePoint服务端对象模型进行查询.为SharePoi ...
- 好神奇的代码,可以让匿名用户对特定SharePoint 列表拥用添加列表项的权限哦
如果你不使用代码,很难从界面上去设置列表的匿名用户(如果可以请告诉我,我会自动删除这个博文)拥有列表项的添加权限. 其实这种需求是非常必要的,比如: 1.允许新用户去提交一个注册申请, 2.在召集临时 ...
- SharePoint 2010 列表项事件接收器 ItemAdded 的使用方法
列表项事件处理器是继承于Microsoft.SharePoint.SPItemEventReceiver的类,Microsoft.SharePoint.SPItemEventReceiver类提供了许 ...
- [sharepoint]rest api文档库文件上传,下载,拷贝,剪切,删除文件,创建文件夹,修改文件夹属性,删除文件夹,获取文档列表
写在前面 最近对文档库的知识点进行了整理,也就有了这篇文章,当时查找这些接口,并用在实践中,确实废了一些功夫,也为了让更多的人走更少的弯路. 系列文章 sharepoint环境安装过程中几点需要注意的 ...
- SharePoint 列表项通过自定义WebService读取
简述:给其他系统提供集成,发现SharePoint自带的WebService各种不好使,索性就自己写一点,也当做自己学习的记录了.当然内容比较简单,希望大侠们不要介意,也不要骂我啊.好了,进入正题吧. ...
随机推荐
- POJ 2154 color (polya + 欧拉优化)
Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). You ...
- Delphi中类的运行期TypeInfo信息结构说明(转载)
Delphi中类的运行期TypeInfo信息结构说明作者:刘啸CnPack开发组 http://www.cnpack.org关键字:RTTI, TypeInfo, TypeData, PropInfo ...
- Linux环境变量具体内容介绍
在Linux中,环境变量是一个很重要的概念.环境变量可以由系统.用户.Shell以及其他程序来设定. 变量就是一个可以被赋值的字符串,赋值范围包括数字.文本.文件名.设备以及其他类型的数据. 下面的例 ...
- shell printf命令:怎样格式化输出语句
printf 命令用于格式化输出, 是echo命令的增强版.它是C语言printf()库函数的一个有限的变形,并且在语法上有些不同. 注意:printf 由 POSIX 标准所定义,移植性要比 ech ...
- jQuery 自执行函数
jQuery 自执行函数 // 为了避免三方名冲突可将全局变量封装在自执行函数内 (function (arg) { var status = 1; arg.extend({ 'xsk': funct ...
- Shell data、timedatectl
data系统时间管理命令 命令date +%F xxxx—xx--xx #查看当前日期. 命令date +%T xx:xx:xx #查看当前时间. 命令date +%y xx #年2位 命令date ...
- 剑指offer(51)构建乘积数组
题目描述 给定一个数组A[0,1,...,n-1],请构建一个数组B[0,1,...,n-1],其中B中的元素B[i]=A[0]*A[1]*...*A[i-1]*A[i+1]*...*A[n-1].不 ...
- Python3 tkinter基础 Menu add_radiobutton 单选的下拉菜单
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- CodeForces 518E Arthur and Questions(贪心 + 思维)题解
题意:给你a1~an,k,要求a1 + ... + ak < a2 + .... + ak+1 < a3 + ... + ak+2 <...,然后这里的ai有可能是?,要求你填?的数 ...
- 6、zabbix使用进阶(02)
zabbix知识点: zabbix可视化 自定义图形(graphs) 屏幕(screen) 宏(macros) 用户参数(User parameters):用户自定义items key的方式来实现自 ...