使用 Graph API 访问共享点站点的私有组中的共享文档文件夹

Accessing the shared documents folder within a private group of a sharepoint site using Graph API

我正在尝试使用 Graph API 将测试文件上传到 Sharepoint 站点。我正在努力将 Graph API 正确指向私人组中共享文档文件夹中的一个点。

假设主持人是devsite.sharepoint.com,私有组是“开发”。在共享文档中有一个名为“TestFolder”的文件夹。

Private Group with folder "TestFolder"

通过在 Graph Explorer 上反复试验,我已使用以下方法成功导航至私人群组。

https://graph.microsoft.com/v1.0/sites/devsite.sharepoint.com:/sites/Development

我尝试使用以下方法访问共享文档文件夹但未成功

https://graph.microsoft.com/v1.0/sites/devsite.sharepoint.com:/sites/Development/drive/root

https://graph.microsoft.com/v1.0/sites/devsite.sharepoint.com:/sites/Development/Shared%20Documents/TestFolder

全部return

Code: BadRequestMessage: Url specified is invalid 要么 The provided path does not exist, or does not represent a site

图表 API 网站文档,不幸的是,没有产生任何有价值的东西,任何来自人群的帮助将不胜感激!

你的第一个电话 https://graph.microsoft.com/v1.0/sites/devsite.sharepoint.com:/sites/Development:/drives returns 是这样的:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
    "value": [
        {
            "createdDateTime": "2021-07-24T23:35:00Z",
            "description": "",
            "id": "b!A1234567-ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210",
            "lastModifiedDateTime": "2021-08-12T16:39:23Z",
            "name": "Dokumente",
            "webUrl": "https://organizationname.sharepoint.com/sites/yourSIteName/folderName",
            "driveType": "documentLibrary",
            "createdBy": {
                "user": {
                    "displayName": "abc"
                }
            },
            "lastModifiedBy": {
                "user": {
                    "email": "bla@organizationame.onmicrosoft.com",
                    "id": "12345678-4321-4321-4321-012345678901",
                    "displayName": "zz"
                }
            },
            "owner": {
                "group": {
                    "email": "x@y.onmicrosoft.com",
                    "id": "09876543-1234-1234-1234-012345678901",
                    "displayName": "Owner of something"
                }
            },
            "quota": {
                "deleted": 345678,
                "remaining": 27487788453406,
                "state": "normal",
                "total": 27487790694400,
                "used": 96120
            }
        }
    ]
}

上面json中description下的id参数就是你的共享文档文件夹drive-id。您可以像这样使用它来访问和导航您的共享文档文件夹:

https://graph.microsoft.com/v1.0/sites/devsite.sharepoint.com/drives/b!A1234567-ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210/root:/yourfile.docx