Forum Discussion
SharePoint site for Office 365 group not created when group is created programmatically via Graph
- Aug 29, 2017
This is now working as expected. You can create O365 groups with SharePoint sites via Graph API using app-only credentials. I am using the PnP UnifiedGroups utility and this works pretty well with a few exceptions though now and than.
https://msdn.microsoft.com/en-us/pnp_articles/modern-experience-customizations-provisioning-sites#provisioning-a-modern-team-site-using-the-pnp-csom-core-component
In theory, it says: "Modern" team sites are created programmatically by creating an Office 365 group using Microsoft Graph. When you create an Office 365 group a "modern" team site is automatically provisioned for the group. The "modern" team site URI will be based upon the mailNickname parameter of the Office 365 group and has the following default structure"
- Per Ola SneveJun 22, 2017Copper Contributor
Yes I have tried it but had problems with the athentification token which always gave me "Unauthorized" (or something) even if the app had full permisions in Azure AD. After several tries I found an other way which works.
My current coding works fine with only Read/Write Group permission, but the site is not created. For this I use a user context to activate by doing a get-request.
- Andrew JonesJun 28, 2017Copper Contributor
I had the same issue with app only authentication and ended up with the same solution as you - make a http request authenticating as a user. The PnP library internally makes a request to the Graph API root drive to try and trigger the site to be provisioned but this too fails with app-only credentials.
Would love to see this change as it's really messy to do http requests as a user in our provisioning engine when we would rather just use app-only authentication.
- Bernd RickenbergAug 29, 2017Brass Contributor
This is now working as expected. You can create O365 groups with SharePoint sites via Graph API using app-only credentials. I am using the PnP UnifiedGroups utility and this works pretty well with a few exceptions though now and than.