Reputation: 1336
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.
Upvotes: 1
Views: 991
Reputation: 2091
Try this:
graphClient.Groups["0745be26-2d8a-4f8d-be2d-37356a4794a3"].Sites["root"].Request().GetAsync().Result;
Upvotes: 1