如何查找与Microsoft SharePoint文档关联的OneDrive项目ID

问题描述 投票:0回答:1

我正在尝试使用JavaScript中的Excel Graph API来更新存储在SharePoint中的Excel文件。从我看到的信息中,我需要文档的OneDrive ID。

https://graph.microsoft.com/ {version} / me / drive / items / {id} / workbook /

我从SpHttpClient获得了所有SharePoint元数据,如何获得OneDrive ID?

javascript sharepoint onedrive spfx
1个回答
0
投票

最后感谢Toni Pohl弄明白了这个>

如果您拥有SharePoint URL,只需将/ list替换为/ drives即可获得OneDrive内容。

https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com:/sites/yyyy:/lists?$select=name,id 
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com:/sites/yyyy:/drives?$select=name,id

获取

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)(name,id)",
    "value": [

        {
            "@odata.etag": "\"57583463-1579-4237-a909-2f99727b188a,5\"",
            "id": "57583463-1579-4237-a909-2f99727b188a",
            "name": "Shared Documents"
        },
        {
            "@odata.etag": "\"4c00f5ba-2e73-475a-b027-ae1597bf16ab,7\"",
            "id": "4c00f5ba-2e73-475a-b027-ae1597bf16ab",
            "name": "DocumentTemplates"
        },       
    ]
}
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives(name,id)",
    "value": [
        {
            "id": "b!5V21gHgALUSQCeWNdx-VSP8SCmeUW3dHqSOlJMbYv2RjNFhXeRU3QqkJL5lyexiK",
            "name": "Documents"
        },
        {
            "id": "b!5V21gHgALUSQCeWNdx-VSP8SCmeUW3dHqSOlJMbYv2S69QBMcy5aR7AnrhWXvxar",
            "name": "DocumentTemplates"
        },

    ]
}

[为了哭泣,微软!!!为什么没有对此进行记录。

© www.soinside.com 2019 - 2024. All rights reserved.