Reputation: 817
By default, when creating an O365 Group, the SharePoint Site that provides document storage for the Group is not created automatically. It gets created on demand when a user navigates to the site for the first time.
I had a provisioning script that got around this problem by making a HTTP GET request to the URL that the user would normally navigate to from Outlook, which looked like: https://[tenant].sharepoint.com/_layouts/15/groupstatus.aspx?id=[groupId]&target=documents
Something must have changed recently because this no longer triggers the Site creation, so my script times out.
Looking at the network traffic when I manually create a group and navigate to the site, I see some calls being made to https://[tenant].sharepoint.com/_api/GroupSiteManager/Create?groupId='[groupId]';
Is this "GroupSiteManager" endpoint documented anywhere, or is there an established (supported) method for forcing the Group Site to be created automatically?
I am using a Provider Hosted Add-In in conjunction with a middle tier processing API, both in Azure, Authenticated with Azure AD (WindowsAzureBearerAuthentication), and Application Permissions to Microsoft Graph.
Upvotes: 1
Views: 354
Reputation: 56
I created an O365 Group with MS Graph and got an resource not found
error when i tried to retrieve information about the site right after that - a assume the same is happening for you.
However, when i tried again a few seconds later it came up with all the information i needed.
Maybe try a GET to this:
https://graph.microsoft.com/v1.0/groups/<your group id>/drive/root/webUrl
at least for me it gave this information after the second try within a few seconds:
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"
}
Upvotes: 1