After using groupTypes:[“Unified”], the office 365 group is created immediately. But when I try to use /groups/groupid/drive to get group site, it throw this error:
{
"error": {
"code": "ResourceNotFound",
"message": "Resource provisioning is in progress. Please try again.",
"innerError": {
"request-id": "c88d754d-d9a5-4a18-bb82-4229b10e560d",
"date": "2016-11-22T08:13:53"
}
}
}
Looks like there is a background process to provision the group site, but more than after 2 hours, this error also is existing.
And when I create office 365 group in Office 365 Portal, the group site is created almost in 1 minute. Why????
Any help?
Thanks!
It looks like the group drive provisioning took over 16 hours in this case (it should be working now). I asked the OneDrive team to look into why it took so long.
Because of this limitation, I must access the sharepoint page https://tenant.sharepoint.com/_layouts/groupstatus.aspx?id=groupid&target=documents
And SharePoint will provision the group site in one minute.
Now the allowExternalSenders and autoSubscribeNewMembers of unified group cannot be retrieved by App-only token.
Now my solution is using Exchange Web Service to create/update/get group.
GetUnifiedGroupDetails, CreateUnifiedGroup, UpdateUnifiedGroup
I cannot find any documentation about these EWS messages. But it actually works. The only information about them:
https://github.com/Microsoft/hummingbird/blob/master/src/Core/ExchangeConnector.cs
Hope MS can improve it in Graph or provide more details about these EWS messages.
Thanks!
The recommendation is to use Microsoft Graph instead of EWS for any group operation. Site creation should be at the same level of the experience. If this is not the case please report back with request ids so we can investigate.
While you closed this some time ago, the same behavior exists with Microsoft Graph via the PNP Powershell commands. Alternatively, if created using rest directly, a site is created immediately, but one must wait for hours until permissions are assigned.
I am still experiencing this issue with Microsoft Graph via the PnP Powershell Cmdlets. It does not happen 100% of the time, but is the case for about 60% of the times I call New-PnPUnifiedGroup. Any workarounds or fixes available?
Same for me. Waiting for fix...
Yup..facing the same issue with Graph API-PnP commandlet
I have found a ''workaround'' if you guys are interested. @poikjo @vipulkelkar
I am not sure if you will be able to apply it to your situation, but in my case I ended up reproducing the REST API call that's done when creating a Modern Team Site on the Sharepoint Website UI.(https://tenant.sharepoint.com/_layouts/15/sharepoint.aspx > + Create Site > Team Site)
That creates my Modern Team Site instantly every time!
Let me know if you have more questions.
I am using the PnP Powershell and apparently in my tenant, the site collection never gets provisioned. Its not a matter of waiting for a few hours in my case :(
I am seeing the same issue - typically about 20 - 30 % of my groups have a 'ResourceNotFound' error and the SharePoint site will not be created. Actually, migrating the Group to a Microsoft Teams does create the SharePoint site, too. So for now I will be reverting to the SharePoint REST API for group creation, too.
Here is a nice sample on how to use the SharePoint API for that purpose (with user/delegated permissions, that do not require a login prompt/pop-up): https://github.com/SharePoint/PnP/tree/master/Samples/Provisioning.Modern.Console.RESTAPI
It would be nice though, to get this fixed in Microsoft Graph.
Seeing this as well, first group (and subsequent modern team site which is what I'm really after as I'm following this guidance on provisioning a modern team site) i provisioned today was fine. Last 3 have all thrown this error.
That is a nice alternative @rickenberg , although its a shame it doesnt work with app only :( So I cant use it from my PnP Partner Pack solution.
"Notice that the SharePoint REST API does NOT work with app-only access, so this model ONLY works in user context"
@awildash - actually I am using exactly this approach in a custom JobHandler in PnP Partner Pack - of course - if you are okay with storing a SharePoint admins credentials in config, Azure app service or Azure vault. You can pass in the username/password into the SharePointOnlineCredentials constructor and set it on the ClientContext as shown in the example, no user interaction is required.
@rickenberg ah interesting, that could be an option. I'll take a look, thanks.
I ended up using New-PnPSite command from the PnP Powershell to create modern Team sites which also creates a Office 365 group instead of connecting to Microsoft graph and createing an Office 365 group. Much more reliable. Although it takes a couple of minutes to provision the entire site so you have to wait a couple of minutes in case you want to start applying template as an immediate step after site creation !
@vipulkelkar guessing OfficeDevPnP.Core doesnt currently have an equivalent.
Edit - sorry just took a look at New-PnPSite code and it is using Core so I'll try this myself, thanks.
var creationInformation = new OfficeDevPnP.Core.Sites.TeamSiteCollectionCreationInformation();
@vipulkelkar and @awildash thanks for pointing this out. This is pretty new in PnP.Core :-). It uses the same endpoint as the PnP sample I was referring to (CreateGroupEx from SharePoint API). I find it very reliable, too. Have created about 1000 groups with it recently and not one creation error.
@rickenberg yea I've been having a look, very new code checked in less than 2 weeks ago and still marked as beta. And yea you're right is almost like they've taken that project you linked to and moved it into PnP. Good to hear its got a tested seal of approval :)
I have a working option. Here is what I did. I use an azure durable function to build out my site.
The fist step is to create the group. When I create the group, I use the vanilla Microsoft Graph calls. (with .net sdk though). You could do with same with javascript rest.
BUT, I also add the owners and members in the initial call. It appears to me if you do this, then you don't have any issues with permissions down the road and any user added as an owner can almost immediately begin modifying the site. I typically allow scripting - so I set this as the first Activity in my orchestrator after creating the group with a retry interval of 15 seconds. On the first or second hit, scripting will be turned off. Once you can turn off scripting, you can do anything else.
`
// I have truncated this - but you will get the picture if you know what you are doing
List
List
myMembers.Add(string.Format("https://graph.microsoft.com/v1.0/users/{0}", ObjectId));
users.Add("[email protected]", myOwners.ToArray());
users.Add("[email protected]", myMembers.ToArray());
newGroup = new Microsoft.Graph.Group
{
DisplayName = displayName,
Description = description,
MailNickname = mailNickname,
MailEnabled = true,
SecurityEnabled = false,
Visibility = isPrivate == true ? "Private" : "Public",
GroupTypes = new List<string> { "Unified" },
AdditionalData = users
};
addedGroup = await client.Groups.Request().AddAsync(newGroup);
`
This will create your group immediately AND your site immediately. You are able to also turn on scripting immediately. The only thing that takes some time is the ability to add a photo and change sharing. For those two items, I use a timer and just recycle it. I usually get both within 15 minutes.
I have created thousands of sites over the past month and had zero issues.
I created solution which works also with Graph API client library (instead of REST calls). The trick is to use the following class which inherits Group from Graph client lib:
public class GroupExtended : Group
{
[JsonProperty("[email protected]", NullValueHandling = NullValueHandling.Ignore)]
public string[] OwnersODataBind { get; set; }
[JsonProperty("[email protected]", NullValueHandling = NullValueHandling.Ignore)]
public string[] MembersODataBind { get; set; }
}
````
and then add it like that:
var newGroup = new GroupExtended
{
DisplayName = displayName,
Description = description,
MailNickname = mailNickname,
MailEnabled = true,
SecurityEnabled = false,
Visibility = isPrivate == true ? "Private" : "Public",
GroupTypes = new List
};
if (owners != null && owners.Length > 0)
{
var users = GetUsers(graphClient, owners);
if (users != null)
{
newGroup.OwnersODataBind = users.Select(u => string.Format("https://graph.microsoft.com/v1.0/users/{0}", u.Id)).ToArray();
}
}
if (members != null && members.Length > 0)
{
var users = GetUsers(graphClient, members);
if (users != null)
{
newGroup.MembersODataBind = users.Select(u => string.Format("https://graph.microsoft.com/v1.0/users/{0}", u.Id)).ToArray();
}
}
await graphClient.Groups.Request().AddAsync(newGroup);
```
Whole solution is described here: http://sadomovalex.blogspot.com/2018/11/create-azure-ad-groups-with-initial.html.