以编程方式获取网站列表的不同方法

时间:2020-01-30 08:22:16

标签: c# sharepoint office365

我正在使用Office365。我已经在Sharepoint上创建了许多站点。我想以编程方式(使用c#)获取所有网站和网站ID的列表。

我使用了GraphServiceClient“ await m_GraphClient.Groups.Request()。GetAsync()”。

但是我想知道更多获取网站列表的方法。

1 个答案:

答案 0 :(得分:2)

您可以尝试搜索。

https://graph.microsoft.com/v1.0/sites?search=*

SPFx中的示例

this.props.context.msGraphClientFactory
      .getClient()
      .then((client: MSGraphClient): void => {       
        client          
          .api("sites?search=*")
          .version("v1.0")
          .get((error, response: any, rawResponse?: any) => {
            console.log(response);            
          });
      })