Is there any API to provision the Office 365 Group Site?

本秂侑毒 提交于 2019-12-08 05:38:27

问题


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


回答1:


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



回答2:


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

"owners@odata.bind": [
    "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




回答3:


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



来源:https://stackoverflow.com/questions/40622558/is-there-any-api-to-provision-the-office-365-group-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!