You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that its also possible to create Tenant templates with the PnP Powershell: Tenant Templates
I expected the code in this repository to work almost equal to the Pnp.Sites.Core, but the following code throws an exception:
using (var context = pnpProvisioningContext.GetContext("https://ourOrg.sharepoint.com/sites/siteSegment"))
{
var tenant = new Microsoft.Online.SharePoint.TenantAdministration.Tenant(context);
var ec = ExtractConfiguration.FromString(System.IO.File.ReadAllText("C:\\temp\\teamExtractConfig.json"));
var template1 = tenant.GetTenantTemplate(ec);
XMLTemplateProvider provider = new XMLFileSystemTemplateProvider(@"C:\temp\teams.json", "");
provider.SaveAs(template1, "TeamTemplate.xml");
}
The following line causes the problem in this repo:
var accessToken = PnPProvisioningContext.Current.AcquireTokenWithMultipleScopes(graphBaseUri.Authority, "Group.ReadWrite.All", "User.Read.All");
Its located in the function "ExtractObjects" in the File ObjectTeam.cs.
PnPProvisioningContext.Current is null here...
The exception seems to be related to authentication, but I am sure my authentication is configured fine, because I can extract normal site templates without problems:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I know that its also possible to create Tenant templates with the PnP Powershell:
Tenant Templates
I expected the code in this repository to work almost equal to the Pnp.Sites.Core, but the following code throws an exception:
The following line causes the problem in this repo:
var accessToken = PnPProvisioningContext.Current.AcquireTokenWithMultipleScopes(graphBaseUri.Authority, "Group.ReadWrite.All", "User.Read.All");
Its located in the function "ExtractObjects" in the File ObjectTeam.cs.
PnPProvisioningContext.Current is null here...
The exception seems to be related to authentication, but I am sure my authentication is configured fine, because I can extract normal site templates without problems:
Beta Was this translation helpful? Give feedback.
All reactions