PnP-Sites-Core icon indicating copy to clipboard operation
PnP-Sites-Core copied to clipboard

Provisining fails due to site collection taxonomy field (local term set)

Open BorAndre opened this issue 7 years ago • 15 comments

PnP-Provisioning-File.txt

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
    
    
    

BorAndre avatar Sep 26 '17 14:09 BorAndre

Me too.

paoIpao avatar Nov 10 '17 10:11 paoIpao

I have the same issue.

khha avatar Jul 02 '18 09:07 khha

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>

ravick4u avatar Sep 19 '18 15:09 ravick4u

@VesaJuvonen Any plan on fixing this issue?

ravick4u avatar Sep 19 '18 15:09 ravick4u

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.

ravick4u avatar Sep 19 '18 15:09 ravick4u

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?

unnieayilliath avatar Nov 06 '18 15:11 unnieayilliath

This issue still not working... has anyone an update?? @PaoloPia @VesaJuvonen @erwinvanhunen

bclevering avatar Feb 26 '19 12:02 bclevering

@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 avatar Feb 26 '19 13:02 unnieayilliath

@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; }

bclevering avatar Feb 26 '19 15:02 bclevering

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.

ChrisOMetz avatar Nov 23 '19 11:11 ChrisOMetz

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

schneika avatar Sep 01 '20 15:09 schneika

The solution for now is to create the term sets in the destination site collection before you run the provisioning script.

kofrimpong avatar Sep 24 '20 19:09 kofrimpong

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 ?

spurr82 avatar Sep 29 '20 18:09 spurr82

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"...

schneika avatar Sep 30 '20 07:09 schneika

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.

spurr82 avatar Sep 30 '20 08:09 spurr82