PnP-Sites-Core
PnP-Sites-Core copied to clipboard
Provisining fails due to site collection taxonomy field (local term set)
Category
[x ] Bug [ ] Enhancement
Environment
[ ] Office 365 / SharePoint Online [x ] SharePoint 2016 [ ] SharePoint 2013
If SharePoint on-premises, what's exact CU version: 16.0.4588.1000
Expected or Desired Behavior
Term groups residing in the site collection term store get exported into the template. These term groups should be restored in a new site collection.
Observed Behavior
The processing of command "Apply-PnpProvisioningTemplate" ends in the following error message:
############ Apply-PnpProvisioningTemplate : The field was found invalid: At line:3 char:1
- Apply-PnpProvisioningTemplate -Path "PnP-Provisioning-File.xml" -ClearNavigation
-
+ CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], Exception + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
#############
Steps to Reproduce
-
create a new team site
-
create a new Managed Metadata Field "TaxFieldSCLevel" bound with a local term set (term set scoped locally to site collection. select "customize a term set").
-
create a new template
-
run "Apply-PnpProvisioningTemplate"
I found this https://github.com/SharePoint/PnP-Sites-Core/issues/572 issue and I see, that the issue was fixed. Is there a new issue?
Additional Info
Full PS Log:
Connect-PnPOnline –Url "http://xxx/sites/PnPTarget" -Credentials $credentials
Apply-PnpProvisioningTemplate -Path "PnP-Provisioning-File.xml" -ClearNavigation
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:19.8427 [OfficeDevPnP.Core] [0] [Information] File PnP-Provisioning-File.xml retrieved from folder 0ms
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:19.8584 [OfficeDevPnP.Core] [0] [Information] File PnP-Provisioning-File.xml retrieved from folder 0ms
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:19.9052 [Provisioning] [11] [Debug] Code execution scope started 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:19.9052 [Provisioning] [11] [Information] ProgressDelegate registered 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:19.9052 [Provisioning] [11] [Information] MessagesDelegate registered 1ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.8116 [Extensibility Providers] [11] [Debug] Code execution scope started 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.8116 [Extensibility Providers] [11] [Debug] Code execution scope ended 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.8428 [Regional Settings] [11] [Debug] Code execution scope started 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.8584 [Regional Settings] [11] [Debug] Code execution scope ended 21ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.8584 [Supported UI Languages] [11] [Debug] Code execution scope started 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.9522 [Supported UI Languages] [11] [Debug] Code execution scope ended 91ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.9522 [Site Security] [11] [Debug] Code execution scope started 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.9990 [Site Security] [11] [Debug] Adding users to group PnPTarget Owners 46ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:20.9990 [Site Security] [11] [Debug] Adding user i:0#.w|...... 46ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:21.3741 [Site Security] [11] [Debug] Code execution scope ended 417ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:21.3741 [Fields] [11] [Debug] Code execution scope started 0ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:21.5305 [Fields] [11] [Debug] Updating field {6d3af308-61a9-46b1-90fe-c34525bf2f35} in site 157ms ab6b4cbc-5aa5-491a-
80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:21.9215 [Fields] [11] [Debug] Adding field {5663a7af-aa0c-4bfd-b766-7da624dc07ea} to site 547ms ab6b4cbc-5aa5-491a-80
e7-b74856da8ddf
PowerShell_ISE.exe Error: 0 : 2017-09-26 13:48:21.9991 [Fields] [11] [Error] The field was found invalid: 624ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Error: 0 : 2017-09-26 13:48:21.9991 [Fields] [11] [Error] Adding field {5663a7af-aa0c-4bfd-b766-7da624dc07ea} failed: The field was found invalid: :
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectField.CreateField(Web web, XElement templateFieldElement, PnPMonitoredScope scope, TokenParser parser,
String originalFieldXml)
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectField.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplat
eApplyingInformation applyingInformation) 624ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:21.9991 [Fields] [11] [Debug] Code execution scope ended 625ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
PowerShell_ISE.exe Information: 0 : 2017-09-26 13:48:21.9991 [Provisioning] [11] [Debug] Code execution scope ended 2094ms ab6b4cbc-5aa5-491a-80e7-b74856da8ddf
Apply-PnpProvisioningTemplate : The field was found invalid:
At line:3 char:1
- Apply-PnpProvisioningTemplate -Path "PnP-Provisioning-File.xml" -ClearNavigation
-
+ CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], Exception + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
Me too.
I have the same issue.
I am using SP2016 and getting the similar issue.
In my case, it's not replacing below token in my MMD Column and provisioning fails
<Property> <Name>TermSetId</Name> <Value xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" p4:type="q2:string" xmlns:q2="http://www.w3.org/2001/XMLSchema">{termsetid:{sitecollectiontermgroupname}:MMDColumn}</Value> </Property>
@VesaJuvonen Any plan on fixing this issue?
On my further research I found out that when we select "Customize your term set" option in Managed Metadata field it stores everything under hidden texonomy list and you can navigate via below url
/Lists/TaxonomyHiddenList/AllItems.aspx
And this list is also missing from template.
This issue is still unresolved. Hmm having site collection terms is very useful. I am struggling with this one now. Should I go ahead and create TermStore wide terms?
This issue still not working... has anyone an update?? @PaoloPia @VesaJuvonen @erwinvanhunen
@bclevering Did you try the provisioning as below sample code in C# ```
// pass template creation info
var template = Ctx.Web.GetProvisioningTemplate(ConfigureTemplateCreationInfo(Ctx.Web));
private static OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateCreationInformation ConfigureTemplateCreationInfo(Web web)
{
var creationInfo = new OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateCreationInformation(web);
creationInfo.IncludeSiteGroups = true;
creationInfo.IncludeSiteCollectionTermGroup = true;// include sitecoll terms
return creationInfo;
}
@unnieayilliath The problem is not exporting the sitecollection termstore but reprovision it to a new website. If i use the 'normal' termstore i can apply it to a new managed metadata field, but the sitecollection termstore fails on doing that.
@bclevering Did you try the provisioning as below sample code in C#
// pass template creation info var template = Ctx.Web.GetProvisioningTemplate(ConfigureTemplateCreationInfo(Ctx.Web));
private static OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateCreationInformation ConfigureTemplateCreationInfo(Web web) { var creationInfo = new OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ProvisioningTemplateCreationInformation(web); creationInfo.IncludeSiteGroups = true; creationInfo.IncludeSiteCollectionTermGroup = true;// include sitecoll terms return creationInfo; }
Me too. I crash in ObjectHandlerBase.cs in the function IsFieldXmlValid line 161 when try Guid.Parse(termSetIdElement.Value) as the Value looks like "{termsetid:Site Collection - xxx.sharepoint.com-sites-test-01:TestMetaDataColumn}"
Would be helpfull just to move this Guid.Parse into the try catch block one line below.
Actual State is, that it is not possible to apply an PnPProvisioningTemplate from one web to another web (Tenant) due to this Managed Metadata Taxononmy specific Provisioning Bug. Any Updates or planned Fixes
The solution for now is to create the term sets in the destination site collection before you run the provisioning script.
Came across this issue today, and need to be able to provision many sies from a template @kofrimpong is the solution for now scriptable also, and i guess this is going to create many replicas ?
Yes its possible to provide Site Templates from one tenant to another, also with working MMS Columns and Termset-Relations.
First get all or specific Termgroups from your Source Tenant:
https://sharepoint-tricks.com/export-term-group-with-pnp-powershell/
Connect-PnPOnline https://SourceTenant.sharepoint.com/ -UseWebLogin $termgroup = Get-PnPTermGroup -GroupName MyTermGroup $termgroup | Export-PnPTermGroupToXml -Out c:\temp\TermGroup.xml
Hint: In the xml-Template you have the Property UpdateBehavior="Overwrite". Then Connect to another Tenant and Import the TermGroups
Connect-PnPOnline https://TargetTenant.sharepoint.com/ -UseWebLogin Import-PnPTermGroupFromXml -Path c:\temp\TermGroup.xml
After that you have your Unique GUIDs for your specific TermGroup, included with Termsets and Terms, all Synonyms, Tem-Descriptions and Languages.
Now you can get and apply your Site Template, considering Multilingual Ressourcefiles:
Connect-PnPOnline https://SourceTenant.sharepoint.com/sites/sourcesite -UseWebLogin Get-PnPProvisioningTemplate -Out C:\temp\SiteTemplate.xml -PersistMultiLanguageResources
Eventually you have to change the the Template-Settings like BaseSiteTemplate="STS#0" or "GROUP#0"
Also you could Restrict your Template to Fields and specific Contenttypes
Get-PnPProvisioningTemplate -Out C:\temp\SiteTemplate.xml -PersistMultiLanguageResources -Handlers Fields, ContentTypes -ContentTypeGroups "MyContentTypes"
otherwise you have to change the SiteOwner or Navigation Settingg in a Full Site Template
Connect-PnPOnline https://TargetTenant.sharepoint.com/sites/targetsite -UseWebLogin Apply-PnPProvisioningTemplate -Path "C:\temp\SiteTemplate.xml" -ResourceFolder c:\temp
Now in the Target you have the MMS-Columns connected to your Termsets.
You can also use the hidden /sites/contenttypehub as target - you can ignore the warning "admin site"...
Thats great thanks, I wont be needing to go cross tenant, this is inside the same tenant that im doing the get / apply to different SCs. I may just use the Add-PnPTaxonomyField to create the fields related to site colleciton taxonomy store, as that seems to work. and for the time being not bother with the temaplating, as the sites are just containing doc libs and some site columns that I need to replicate to many sites.