【问题标题】:Determine SharePoint site url to Office Group确定 Office 组的 SharePoint 网站 URL
【发布时间】:2017-02-09 14:20:54
【问题描述】:
在使用 Microsoft Graph API 创建办公组后,我正尝试以编程方式检索有关 SharePoint 网站的信息。
每个 office 组都分配了一个 SharePoint 网站,但我无法确定该网站的 url,除非手动浏览到该网站并复制它。
这不是一个可行的解决方案,因为我必须在相应的 SharePoint 网站上创建数百个 Office 组并订阅 webhook。
这个link 对我来说也很重要,因为我不想每次都在创建网站之前手动打开它。
【问题讨论】:
标签:
sharepoint
office365
microsoft-graph-api
【解决方案1】:
您可以通过使用您的组 ID 发出 GET 请求来做到这一点
https://graph.microsoft.com/v1.0/groups/<your group id>/drive/root/webUrl.
这将为您提供有关 SharePoint 网站上文档的信息,包括 URL。
你会得到这样的东西:
cache-control: private
content-type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
request-id: <some id>
client-request-id: <some id>
Status Code: 200
{
"@odata.context": https://graph.microsoft.com/v1.0/$metadata#groups(<your group id>)/drive/root/webUrl",
"value": "https://<your tennant>.sharepoint.com/sites/<generated SharePoint name>/Shared%20Documents"
}
如果您对新创建的组执行此操作,则该站点尚不存在,因此您将收到resource not found 响应。但当你再次尝试时,它会给出预期的答案。