I am using PnP to set up a number of site collections with the same set of site columns and content types. Initially I created an XML provisioning file from a site I set up, but when I applied it to another site there were issues adding the content types and creating some site columns that were using the term store to lookup values. So now I am trying to set up the site columns and content types using Pnp PowerShell instead.
I could use some help translating some of the fields in the provisioning xml file to a PnP PowerShell command.
I wonder how to specify the -ID
, should I use curly brackets or not? And how should I specify the -TermSetPath
?
In the term store, I have a node XXX, where I have the term set Classification accessible for all sites in my hub. But since this is not open for everyone to add terms, I am planning on finding some PnP command to move those locally for each site.
So I will store "Classification" under the "Site Collection - xx.xxx.com-sites-thisSite" node. In the provisioning xml this is specified as {termsetid:{sitecollectiontermgroupname}:Classification}
. How do I specify that to the Pnp command?
This is what I got:
The PnP PowerShell command:
Add-PnPTaxonomyField -DisplayName "Classification" -InternalName "Classification" -Group "XXX" -ID "cd165a06-9295-438b-90ef-20786be3a1fc" -TermSetPath "TestTermGroup|TestTermSet"
From the provisioning XML file:
<Field Type="TaxonomyFieldType" DisplayName="Classification" List="{{listid:TaxonomyHiddenList}}" WebId="{siteid}" ShowField="Term1033" Required="FALSE" EnforceUniqueValues="FALSE" Group="XXX" ID="{cd165a06-9295-438b-90ef-20786be3a1fc}" SourceID="{{siteid}}" StaticName="Classification" Name="Classification" Description="'Classification' is used to specify ...">
<Default>
</Default>
<Customization>
<ArrayOfProperty>
<Property>
<Name>SspId</Name>
<Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{sitecollectiontermstoreid}</Value>
</Property>
<Property>
<Name>TermSetId</Name>
<Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{termsetid:{sitecollectiontermgroupname}:Classification}</Value>
</Property>
</Customization>
</Field>
And there is also another field generated in the provisioning xml, that seems coupled with the field I am trying to add. Do I need to add this field as well?
<Field Type="Note" DisplayName="Classification_0" StaticName="cd165a069295438b90ef20786be3a1fc" Name="cd165a069295438b90ef20786be3a1fc" ID="{72bd59fd-153c-4ab6-b49b-c40cd77853c8}" ShowInViewForms="FALSE" Required="FALSE" Hidden="TRUE" CanToggleHidden="TRUE" SourceID="{{siteid}}" />
And (a bonus question) the List="{{listid:TaxonomyHiddenList}}"
from the provisioning xml file, how is that translated to the PnP command? Do I need to resolve listid
to something?