SharePoint 2013 - REST API about Content

1. 获取所有子站点信息(Sub Site):

var subSitesInfo = "{0}/_api/Web/WebInfos?$orderby=Title desc"; // {0} -> web Absolute Url

返回的数据:

SharePoint 2013 - REST API about Content

2. 获取所有的List和Library:

var listLibInfo = "/_api/Web/lists?$filter=Hidden ne true&$expand=RootFolder,HasUniqueRoleAssignments&$select=Title,Id,ParentWebUrl,BaseType,Items,RoleAssignments,ItemCount,RootFolder/ServerRelativeUrl,RootFolder/ItemCount,HasUniqueRoleAssignments&$orderby=Title";

返回的数据如下,需要注意的是,BaseType有四种值:0 是 list, 1 是 library, 4 是 survey, and 5 是 issuetracking

SharePoint 2013 - REST API about Content

3. 获取List或Library中的所有Item(遍历读取所有文件夹下的item):

var itemsInListOrLibInfo = "{0}/_api/Web/Lists(guid'{1}')/Items"; //{0} -> web Absolute Url, {1} -> guid of list/lib

返回的数据如下,但是一般情况下,我们并不使用此种方法来获取Library中的数据;

SharePoint 2013 - REST API about Content

4. 获取文件夹下的item信息(只包含当前目录下的item信息,无遍历),也用作获取library目录下的item信息(只包含根目录下的item信息,无遍历):

var itemsInFolderInfo = "{0}/_api/Web/GetFolderByServerRelativeUrl('{1}')?$expand=Folders,Files&$select=Folders/Name,Folders/ServerRelativeUrl,Folders/ItemCount,Files/Name,Files/ServerRelativeUrl"; //{0} -> web Absolute Url, {1} -> server-relative url of a folder

返回数据如下,

SharePoint 2013 - REST API about Content

5.

上一篇:awk中使用shell的环境变量


下一篇:JS 文本输入框放大镜效果