gpt4 book ai didi

c# - 如何使用 graph api 访问 Sharepoint 文档中心

转载 作者:行者123 更新时间:2023-11-30 22:55:04 24 4
gpt4 key购买 nike

我正在尝试使用 Microsoft Graph 从我们的 SharePoint 文档中心检索文档。我可以访问我们的基本 SharePoint 网站,但似乎无法深入到文档中心。

我们的文档中心网址是<sharepoint_host>/sites/DocumentCenter .我希望能够查看和上传 <sharepoint_host>/sites/DocumentCenter/Prospects 下的文件.

尝试了多种方法来查看我是否可以到达文档中心,例如:

graphServiceClient
.Sites["<sharepoint_host>"]
.SiteWithPath("DocumentCenter")
.Request().GetAsync()

但似乎又无法达到它。使用 Microsoft Graph SDK for .NET .

最佳答案

假设 /sites/DocumentCenter 对应租户站点集合,Prospects 对应列表/库,Site resource可以通过服务器相对 URL 路径 检索,如下所示:

GET https://graph.microsoft.com/v1.0/sites/{tenant}.sharepoint.com:/sites/DocumentCenter

Refer docs on how to address a site resource by path

检索List resource可以使用以下端点:

GET https://graph.microsoft.com/v1.0/sites/{tenant}.sharepoint.com:/sites/DocumentCenter:/lists/Prospects

示例

var site = await graphClient.Sites["contoso.sharepoint.com"].SiteWithPath("/sites/DocumentCenter").Request().GetAsync();
Console.WriteLine(site.Name);

关于c# - 如何使用 graph api 访问 Sharepoint 文档中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55632209/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com