Error when provisioning a template with a TeamSite and MS Teams (or teamify)
See original GitHub issueWhen provisioning a Template that contains a pnp:TeamSite, and a MS teams node (or just the “teamify” attribute in the TeamSite), you get an exception from MS Graph API, as the Group behind the TeamSite was created with no Owners nor Members.
As far as we’ve seen debugging, the Teams object handler is calling:
private static string CreateOrUpdateTeamFromGroupInternal(PnPMonitoredScope scope, Team team, TokenParser parser, string groupId, string accessToken)
and that method calls the Graph helper
teamId = GraphHelper.CreateOrUpdateGraphObject(scope,
HttpMethodVerb.PUT,
$"{GraphHelper.MicrosoftGraphBaseURI}v1.0/groups/{groupId}/team",
content,
HttpHelper.JsonContentType,
accessToken,
"Conflict",
CoreResources.Provisioning_ObjectHandlers_Teams_Team_AlreadyExists,
"id",
parser.ParseString(team.GroupId),
CoreResources.Provisioning_ObjectHandlers_Teams_Team_ProvisioningError,
canPatch: true);
and although there´s no Exception, the TeamId is returned as null, as the helper is catching the MS Graph API exception. The request to Graph API is:
PUT https://graph.microsoft.com/v1.0/groups/{group_id}/team HTTP/1.1
{"funSettings":{"allowGiphy":true,"giphyContentRating":"moderate","allowStickersAndMemes":true,"allowCustomMemes":true},"guestSettings":{"allowCreateUpdateChannels":false,"allowDeleteChannels":false},"memberSettings":{"allowCreateUpdateChannels":true,"allowAddRemoveApps":true,"allowDeleteChannels":true,"allowCreateUpdateRemoveTabs":true,"allowCreateUpdateRemoveConnectors":true,"allowCreatePrivateChannels":false},"messagingSettings":{"allowUserEditMessages":true,"allowUserDeleteMessages":true,"allowOwnerDeleteMessages":true,"allowTeamMentions":true,"allowChannelMentions":true}}
and the response says clearly that there´s no Owner for that group.
{
"error": {
"code": "BadRequest",
"message": "Team owner not found for group 10107cf.........633.",
"innerError": {
"date": "2021-01-27T15:37:35",
"request-id": "9f4beda6-....1deb8f",
"client-request-id": "9f4b......deb8f"
}
}
}
the problem here is that we cannot specify an Owner when creating the TeamSite, as the PnP Schema doesn´t allow it.
Any thoughts here? @PaoloPia @jansenbe
Many thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
[BUG] Error internal to Apply_PnPTenantTemplate - ...
Properly formatted PnP Provisioning Template with two teams ... it seems to have created the associated Group and Team Site in SharePoint.
Read more >How to create a Microsoft teams to an existing team site?
Hi there, We have this team site and would like to connect/add an MS teams but there's no option/ button showing on our...
Read more >Error when provisioning a site
I have a simple site as template and the extract works just fine. But when I try to Provision it to another site...
Read more >Sharepoint Online - Provisioning Failure - Microsoft Q&A
From what i understand the provisioning tool creates new sites based on a template. Is there a way to manually create the site...
Read more >Access denied when applying template to team site (Group ...
Hi,. I'm trying to export and import a team site (group site) from Office 365 but I have a few issues applying the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@luismanez - this is a bit “complex” , requiring us to change the schema to support owners property which might take sometime .
As a temporary workaround , we can try it as below using the UnifiedGroupsUtility’s CreateUnifiedGroup method. You can specify the owner array as well and pass the same access token inside the PnPProvisioningContext. Once the group + team are created, you can then apply the PnP Template to the created team site.
I can confirm that the template posted above is enough to get the error when using App Only auth. Code below is how we´re calling ApplyTenantTemplate:
The tokenProvider.GetAccessToken function is returning a valid token for MS Graph. Actually, the Group is created using Graph API, but as the framework is not adding any Owner to the group, and using AppOnly token, no Owners are added to the Group, and the next call to configure the MS Teams team (teamify group), fails with the error already mentioned below.
I think the solution here is to allow to pass an Owner from the Schema, like actually is already done with pnp:TeamSiteNoGroup
BTW, also tested to create a TeamSite with NO Group, and then tried to Groupify and Temify, but in this case it also fails in a different point.