Closed mbalcarek closed 3 years ago
@mbalcarek : can you share the created template (the template.xml file)?
Got the same...
Please have mine....
<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema">
<pnp:Preferences Generator="PnP.Framework, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" />
<pnp:Templates ID="CONTAINER-TEMPLATE-8DC33C5F9BBB442B8BD82870854E0F56">
<pnp:ProvisioningTemplate ID="TEMPLATE-8DC33C5F9BBB442B8BD82870854E0F56" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite">
<pnp:ClientSidePages>
<pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="true" Overwrite="true" Title="MixedPage-Template" ThumbnailUrl="" PageName="Templates/MixedPage-Template.aspx">
<pnp:Header Type="Default" LayoutType="FullWidthImage" TextAlignment="Center" ShowTopicHeader="false" ShowPublishDate="false" TopicHeader="" AlternativeText="" Authors="[]" AuthorByLine="[]" AuthorByLineId="-1" />
<pnp:Sections>
<pnp:Section Order="1" Type="OneColumn" BackgroundEmphasis="Neutral">
<pnp:Controls>
<pnp:CanvasControl WebPartType="QuickLinks" JsonControlData="{"id": "c70391ea-0b10-4ee9-b2b4-006d3fcad0cd", "instanceId": "e042ed33-d580-4993-9e23-33c06ca84912", "title": "Quick links", "description": "Quick links", "dataVersion": "2.2", "properties": {"items":[],"isMigrated":true,"layoutId":"Grid","shouldShowThumbnail":true,"imageWidth":400,"buttonLayoutOptions":{"showDescription":false,"buttonTreatment":2,"iconPositionType":2,"textAlignmentVertical":2,"textAlignmentHorizontal":2,"linesOfText":2},"listLayoutOptions":{"showDescription":false,"showIcon":true},"waffleLayoutOptions":{"iconSize":1,"onlyShowThumbnail":false},"hideWebPartWhenEmpty":true,"dataProviderId":"QuickLinks","webId":"{siteid}","siteId":"{sitecollectionid}"}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{"baseUrl":"https://{fqdn}{site}"},"componentDependencies":{"layoutComponentId":"706e33c8-af37-4e7b-9d22-6e5694d92a6f"}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="c70391ea-0b10-4ee9-b2b4-006d3fcad0cd" Order="1" Column="1" />
</pnp:Controls>
</pnp:Section>
<pnp:Section Order="2" Type="TwoColumn">
<pnp:Controls>
<pnp:CanvasControl WebPartType="Text" ControlId="9db2789a-661c-40e6-a6f7-9508a509735c" Order="1" Column="1">
<pnp:CanvasControlProperties>
<pnp:CanvasControlProperty Key="Text" Value="{{Topic:Title}}" />
</pnp:CanvasControlProperties>
</pnp:CanvasControl>
<pnp:CanvasControl WebPartType="Text" ControlId="9db2789a-661c-40e6-a6f7-9508a509735c" Order="2" Column="1">
<pnp:CanvasControlProperties>
<pnp:CanvasControlProperty Key="Text" Value="{{Topic:Description}}" />
</pnp:CanvasControlProperties>
</pnp:CanvasControl>
<pnp:CanvasControl WebPartType="List" JsonControlData="{"id": "f92bf067-bc19-489e-a556-7fe95f508720", "instanceId": "098419d4-440a-4047-abf1-cc7331ad1756", "title": "List", "description": "List", "dataVersion": "1.0", "properties": {"isDocumentLibrary":true,"selectedListId":"{listid:Documents}","selectedListUrl":"{site}/Shared Documents","webRelativeListUrl":"/Shared Documents","webpartHeightKey":4,"selectedViewId":"{viewid:Documents,All Documents}"}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{"listTitle":"Documents"},"imageSources":{},"links":{}}, "dynamicDataPaths": {}, "dynamicDataValues": {"filterBy":{}}}" ControlId="f92bf067-bc19-489e-a556-7fe95f508720" Order="3" Column="1" />
<pnp:CanvasControl WebPartType="Custom" JsonControlData="{"id": "9fb420d0-8958-421d-a64f-bc86fac4b1a5", "instanceId": "33c1744c-9112-40dd-a39d-2ca6580dfc65", "title": "Topic Videos Browser", "description": "Topic Videos Browser", "dataVersion": "1.0", "properties": {"topicId":484,"itemsNumber":10}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="9fb420d0-8958-421d-a64f-bc86fac4b1a5" Order="1" Column="2" />
<pnp:CanvasControl WebPartType="People" JsonControlData="{"id": "7f718435-ee4d-431c-bdbf-9c4ff326f46e", "instanceId": "189d9d10-4539-4f96-a1bd-8f6ac3397d54", "title": "People", "description": "People", "dataVersion": "1.3", "properties": {"layout":1,"persons":[]}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{"title":"Topic Owner"},"imageSources":{},"links":{}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="7f718435-ee4d-431c-bdbf-9c4ff326f46e" Order="2" Column="2" />
</pnp:Controls>
</pnp:Section>
</pnp:Sections>
</pnp:ClientSidePage>
</pnp:ClientSidePages>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>
Please also find the exception
provisioning [dev ≡]> Get-PnPException
Message : Object reference not set to an instance of an object.
Stacktrace : at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.CreatePage(Web web, Provisioni
ngTemplate template, TokenParser parser, PnPMonitoredScope scope, BaseClientSidePage clientSidePage,
String pagesLibrary, List pagesLibraryList, Int32& currentPageIndex, List`1 preCreatedPages)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.ProvisionObjects(Web web, Prov
isioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInfor
mation)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web
, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean c
alledFromHierarchy, TokenParser tokenParser)
at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
ScriptLineNumber : 35
Same error when trying to deploy some lists/fields to a site. Template XML attached.
Error thrown by script line 87:
Invoke-PnPSiteTemplate -Path $templateFileName -Handlers Lists
Get-PnPException output:
_Message : Object reference not set to an instance of an object.
Stacktrace : at PnP.Framework.AuthenticationManager.1.ConfiguredTaskAwaiter.GetResult() at PnP.Framework.AuthenticationManager.<GetAccessTokenAsync>d__43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at PnP.PowerShell.Commands.Provisioning.TokenRetrieval.<GetAccessTokenAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.<>c.<<ExecuteCmdlet>b__16_3>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at PnP.Framework.Provisioning.ObjectHandlers.PnPProvisioningContext.AcquireToken(String resource, String scope)
at Microsoft.SharePoint.Client.ClientContextExtensions.GetAccessToken(ClientRuntimeContext clientContext)
at Microsoft.SharePoint.Client.ClientContextExtensions.IsAppOnly(ClientRuntimeContext clientContext)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.UpdateList(Web web, List existingList, ListInstance templateList, TokenParser parser, PnPMonitoredScope
scope, Boolean isNoScriptSite)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser,
ProvisioningTemplateApplyingInformation applyingInformation)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template,
ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)
at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation
applyingInformation)
at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
ScriptLineNumber : 87_
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
I am getting this issue while provisioning template. Below is error.
Message : Object reference not set to an instance of an object.
Stacktrace : at Microsoft.SharePoint.Client.FieldAndContentTypeExtensions.BestMatch(String contentTypeId, IEnumerable`1 contentTypeCollection)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.CreateView(Web web, View view, ViewCollection existingViews, List createdList,
PnPMonitoredScope monitoredScope, TokenParser parser, Int32 currentViewIndex, Int32 total)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProcessViews(Web web, TokenParser parser, PnPMonitoredScope scope, ListInfo
listInfo)
at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser,
ProvisioningTemplateApplyingInformation applyingInformation)
at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template,
ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)
at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet()
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()
ScriptLineNumber : 15
I have got the same problem... I got the template with this code from a dev tenant and I can't Import it into the production tenant.
$FilePath = "C:\temp\sitetemplate.xml"
Get-PnPSiteTemplate -Out $FilePath -Handlers PageContents -IncludeAllClientSidePages -PersistBrandingFiles -Force
After connecting to the site, I fire this command, but the error displayed below pops up.
Invoke-PnPSiteTemplate -Path $FilePath
Message : Object reference not set to an instance of an object. Stacktrace : at Microsoft.SharePoint.Client.FieldAndContentTypeExtensions.IsChildOf(ContentTypeId current, ContentTypeId contentTypeId) at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.CreatePage(Web web, ProvisioningTemplate template, TokenParser parser, PnPMonitoredScope scope, BaseClientSidePage clientSidePage, String pagesLibrary, List pagesLibraryList, Int32& currentPageIndex, List`1 preCreatedPages) at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePages.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser) at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation) at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet() in D:\a\powershell\powershell\src\Commands\Provisioning\Site\InvokeSiteTemplate.cs:line 327 at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 114 ScriptLineNumber : 39
I am getting similar issues with Invoke-PnPSiteTemplate, why was this issue closed?
am getting the same error , any idea please or other suggestion to copy a site from tenant to another
I am trying to copy a customized home page home.aspx from one site collection to another. Both are modern team sites without Teams. Please note there is a home.aspx in both the source and target urls.
` $pageName = "Home.aspx"
results: