我正在尝试获取租户下的所有站点,其中有些丢失。我们最近创建了一个新站点(不是子站点),在使用Microsoft Graph搜索时找不到该站点。
这是我们正在使用的请求网址:
https://graph.microsoft.com/v1.0/sites/?search=*
我也尝试过使用beta文档中的该网址,但它也不起作用:
https://graph.microsoft.com/beta/sites?filter=root%20ne%20null&select=siteCollection,webUrl
不过,我可以通过get by path网址找到它:
https://graph.microsoft.com/v1.0/sites/{hostname}:/{site-path}
网站在搜索时是否需要特定设置才能显示在结果中?
我希望能够列出所有存在的共享点站点。
答案 0 :(得分:0)
根据我的最新测试,以下网址无法处理相同的数据,因此结果不同(请注意我的代码注释):
//just return the team site(subsite of teams/sites)
https://graph.microsoft.com/v1.0/sites/{hostname}:/{site-path}
//Will return the tenant site collection
https://graph.microsoft.com/beta/sites/root?select=siteCollection,webUrl&filter=root%20ne%20null
要获取小组的现代团队网站,我们需要使用Microsoft Graph中的小组终点。没有API可以直接列出所有现代团队站点,我们可以遍历各个组,然后使用以下API获取站点URL:https://graph.microsoft.com/v1.0/groups/<group-id>/drive/root/webUrl.
请检查您遇到问题的网站是否为现代团队网站?
第三博客的一些参考文献:
https://www.eliostruyf.com/get-the-site-url-of-an-office-365-group-via-the-microsoft-graph/