I am working on some sharepoint farms of these types:-
- SP 2013 on-premises.
- SP 2016 on-premises.
- SharePoint Online.
Now when I want to move some Pages libraries between farms using the
Export-SPWeb operations, then for the Import operation to work correctly the term sets and terms need to have the same GUIDs inside the source farm (the farm i do the Export-SPWeb operation on) and the destination farm (the farm i do the Import-SPWeb operation on). for example if the Pages library contain managed metadata columns which are linked to term sets, then to preserve the association between the term set and the site column inside the imported list, then the term sets and terms' GUIds need to be the same on both farms.
so i usually create the term sets and terms using powershell inside the destination farm. where using power-shell i can in advance provide the GUID for these components, so the term sets and terms will have the same GUID inside different farms.after that i can import/export the pages libraries, and they got associated with the correct term sets and terms. here is a sample of the power-shell scripts i am talking about:-
$termSet = $termGroup.CreateTermSet("Departments","c7d65978-750d-451d-9cf2-96c35f9d16ea","1033") $termStore.CommitAll() #Connect to existing term set $termset = $termGroup.Termsets["Departments"] $term = $termSet.CreateTerm("Customer Services",1033,"54b5c0bd-f203-4798-b3c9-0a1143ffdb0b") $termStore.CommitAll()
but today i got this concern if there are any risks of providing the GUIDs when creating Sharepoint components using powershell. so can anyone advice on these 2 points:-
If in the future we create some components such as term sets & terms using the UI, so could we face a problem that sharepoint will try to assign a GUID which were already provided inside our power-shell script?
Inside our power-shell scripts how we can be sure that the GUIDs we are providing are not being already assigned to other components? for example in the above script i am using GUIDs from FarmA for the term sets and terms, then i am creating these term sets and terms inside FarmB.. so is this a safe operation?