【问题标题】:List folder contents of 'Shared with Me' folder from Office 365 OneDrive (Sharepoint) for Business and Education using the REST api?使用 REST api 从 Office 365 OneDrive (Sharepoint) for Business 和 Education 列出“与我共享”文件夹的文件夹内容?
【发布时间】:2015-01-29 17:54:22
【问题描述】:

有没有办法从 Office 365 (Sharepoint) REST api 获取“与我共享”文件夹的内容?

我在 api 参考中看不到任何内容。 https://msdn.microsoft.com/office/office365/APi/files-rest-operations

【问题讨论】:

    标签: rest sharepoint office365 onedrive


    【解决方案1】:

    找到了解决办法...

    您必须使用共享点搜索 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})'
    

    确保父链接是 url 编码的。您可以从文件夹属性中检索父链接。

    最后要获取第一个请求中使用的帐户名称,您可以向 sharepoint webs api 发出请求。

    https://{tenant}-my.sharepoint.com/_api/web/CurrentUser
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 1970-01-01
      • 2016-05-15
      相关资源
      最近更新 更多