简体   繁体   中英

Microsoft Graph SDK get site url after group is created

I try to retrieve the site url when a microsoft-365 group is created in sharepoint using graph sdk. I read from docs that in order to access a group team site I should use GET /groups/{group-id}/sites/root BUT I don't know how to do it.

Also I have tried code below but throws exception that resource was not found.

var site = await graphClient.Sites[$"/groups/{group.Id}/sites/root"]
    .Request()
    .GetAsync();

I would like to know if I can modify the code above and use the group id to retrieve the active site url. Thanks in advance.

Try this:

 graphClient.Groups["0745be26-2d8a-4f8d-be2d-37356a4794a3"].Sites["root"].Request().GetAsync().Result;

My test result: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM