Jun 21 2017 01:02 AM - edited Jun 21 2017 02:16 AM
I have created Office 365 Group programmatically via C# and Graph. The group shows up as expected in Outlook but when I try to enter the site https://<tenant>.sharepoint.com/teams/<mailNickName> I just got an "empty" page with:
HTTP/1.1 200 OK Server: Microsoft-IIS/8.5 Date: Wed, 21 Jun 2017 07:56:01 GMT Connection: close
When I try to access the site via Csom I get to the root https://<tenant>.sharepoint.com and not the created Group Site.
To generate the Group Site I have to go to URL:
https://<tenant>.sharepoint.com/_layouts/groupstatus.aspx?id=d4583dd1-f66b-4a32-a780-2d695fe61f70&target=site
where id is the group ID. After 5-10 seconds it's generated. When I try to fire of the URL from my app, I get Unauthorized even if the app have full authorization/all permisions for SharePoint in Azure Ad.
Are there any way I can generate the group site programmatically?
Addition: I have tried to authenticate the http request as myself in the c# app. It succed for https://<tenant>.sharepoint.com/_api/web/lists but fails with the same authentification with Unathorized for https://<tenant>.sharepoint.com/_layouts/groupstatus.aspx?id=d4583dd1-f66b-4a32-a780-2d695fe61f70&target=site
Jun 21 2017 05:04 AM
I finally got it working by using SharePoint Online HTTP handler (SPHttpClientHandler) from this page to post the activation url. It uses a logged on users context and not Azure App context.
I still wonder if it's possible to create the Office 365 SharePoint site using Azure App authorization
Jun 22 2017 12:00 AM
Jun 22 2017 01:55 AM
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.
Jun 28 2017 04:37 PM
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.
Aug 29 2017 03:16 AM
SolutionThis 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.
Aug 29 2017 03:16 AM
SolutionThis 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.