Microsoft GraphAPI和Sharepoint:列出共享文件

时间:2020-04-30 15:05:05

标签: sharepoint microsoft-graph-api

所以我不确定我要去哪里错了,但是这里走了!

我想通过MS GraphAPI列出我的测试Sharepoint网站上的文件。通过文档进行的操作应该很简单,但这只是没有发生!

我正在使用GraphAPI资源管理器 https://developer.microsoft.com/en-us/graph/graph-explorer/preview

然后我可以通过此呼叫查看我的网站及其共享文件夹

https://graph.microsoft.com/v1.0/sites/MyCompany.sharepoint.com:/sites/burf-test:/drive

我回来了:

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
    "createdDateTime": "2020-04-19T05:47:58Z",
    "description": "",
    "id": "b!BWveRisE5UWH2b_vq03PZYmZdMdKpQtFhpIQSacsCowq3ZxYLFsFQKtzuZ4-V1ya",
    "lastModifiedDateTime": "2020-04-30T13:50:28Z",
    "name": "Documents",
    "webUrl": "https://-.sharepoint.com/sites/Burf-Test/Shared%20Documents",
    "driveType": "documentLibrary",
    "createdBy": {
        "user": {
            "displayName": "System Account"
        }
    },
    "owner": {
        "group": {
            "email": "Burf-Test@-.onmicrosoft.com",
            "id": "e48afefa-2aa8-4cd5-aad9-62f746a991c2",
            "displayName": "Burf-Test Owners"
        }
    },
    "quota": {
        "deleted": 0,
        "remaining": 0,
        "total": 0,
        "used": 0
    }
}

我找不到列出可以通过Sharepoint门户(Burf-Test)看到的文件的方法吗? 尝试过

  • / drive / root / children
  • / drive / b!BWveRisE5UWH2b_vq03PZYmZdMdKpQtFhpIQSacsCowq3ZxYLFsFQKtzuZ4-V1ya
  • / drives / b!BWveRisE5UWH2b_vq03PZYmZdMdKpQtFhpIQSacsCowq3ZxYLFsFQKtzuZ4-V1ya
  • /驱动器/文档
  • /列表等

还有更多!

1 个答案:

答案 0 :(得分:0)

因此,这里的主要问题实际上是权限,有时Graph Explorer会说访问被拒绝,有时会返回200,但不显示文件。两者都意味着权限问题。

我发现我必须授予额外的权限(文件权限)才能使它工作

https://graph.microsoft.com/v1.0/sites/a-.sharepoint.com,SITE-GUID/drives/FOLDER-GUID/root/children