1
votes

When we click the File/Site in OWA, it will redirect to a SharePoint page like this: https://.sharepoint.com/_layouts/groupstatus.aspx?id=&target=documents

In this page, the office 365 group site will be created if the Group site is not existing.

Like user OneDrive site, we can provision it via Microsoft.SharePoint.Client.UserProfiles.PeopleManager.GetDefaultDocumentLibrary So is there any API provisioning group site for specified group? Microsoft Graph API, AAD Graph or SharePoint Client API, any one?

And when I create an Office 365 Group in Office 365 Portal, the group site will be created automatically after some minutes. But when I create the group in exchange online or by MS Graph API, the group site cannot be created. When I try to access /groups/groupid/drive, I got this error

Status Code: 404

{ "error": { "code": "ResourceNotFound", "message": "Resource provisioning is in progress. Please try again.", "innerError": { "request-id": "4f7e6581-4092-4fdb-834f-67c0b4f400b4", "date": "2016-11-22T05:59:52" } } }

Thanks

3

3 Answers

1
votes

I was able to pre-created the Files (SharePoint site) after Office 365 Group provisioning, all by using PowerShell

  1. New-UnifiedGroup / creates Office 365 group
  2. Grab the Group ID using Get-UnifiedGroup, property "ExternalDirectoryObjectId"
  3. Connect-PnPMicrosoftGraph
  4. Get-PnPUnifiedGroup with the ID
1
votes

When creating groups through Microsoft Graph the expectation is that the SharePoint site is immediately available. Unfortunately the way the Microsoft Graph API is designed it allows creation of a group in app-only without providing an owner. That scenario is a broken scenario in SharePoint, because it translates into anonymously create a site and that’s unsupported.

In conclusion, if you are calling Microsoft Graph in app-only mode to create groups, pass the owner at creation time, not as subsequent operation post group creation.

In the JSON payload on creation you need to pass this in

"[email protected]": [
    "https://graph.microsoft.com/v1.0/users/{id}"
]

This is explained here in the documentation https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/group_post_owners

0
votes

When you create a unified group using the Microsoft Graph API, it takes care of doing all the orchestration of provisioning all the services for the group, the mailbox for conversations, the calendar, the site with the document library for files, etc. Documentation here: https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/group_post_groups. You will need to specify "groupTypes": ["Unified"] in the body