有没有办法获取“与我共享”的内容? Office 365(Sharepoint)REST API?
中的文件夹我无法在api引用中看到任何重复此内容的内容。 https://msdn.microsoft.com/office/office365/APi/files-rest-operations
答案 0 :(得分:2)
找到解决方案......
您必须使用sharepoint搜索API,而不是使用文件api。 具有KQL查询参数的以下端点可用于获取与我共享的文件列表
https://{tenant}-my.sharepoint.com/_api/search/query?querytext='(SharedWithUsersOWSUSER:{UserAccountName} AND contentclass:STS_ListItem_MySiteDocumentLibrary)'
上面的内容将获取与我共享的文件列表,但不包含共享文件夹中的任何内容。要获取共享文件夹中的项目,可以使用以下端点。
https://{tenant}-my.sharepoint.com/_api/search/query?querytext='(ParentLink:{ParentLink})'
确保父链接已进行网址编码。您可以从文件夹属性中检索父链接。
最后,要获取第一个请求中使用的帐户名,您可以向sharepoint网站api发出请求。
https://{tenant}-my.sharepoint.com/_api/web/CurrentUser