Share via


SharePoint- Export/Import Managed Metadata Terms through CSV

This custom PowerShell script is to export the SharePoint Managed Metadata term store into a CSV file. Please make a note that this script would be handy when there is a need to move the managed metadata across environments where the IDs doesn’t matter.

The script would be completed by the import script which would allow the admins to add/update the items through the CSV itself.

These scripts would be helpful when there is need of synchronizing the MMS across environments or to export the MMS to excel for some non-technical needs.

Exporting the SharePoint Managed Metadata

  • Any term store on any SharePoint farm can be exported with the script named ExportMMStoCSV.ps1 .

  • Navigate to the file ensure the parameters central Admin URL and Managed Metadata services name are in par with the environment.

  • Login to admin server as farm admin

  • Open the PowerShell ISE as administrator

  • Open the ExportMMStoCSV.ps1

  • Execute the script.

  • The script, upon completion generates a CSV file on the same folder where the script is located.

  • The file consists of information in the following sequence.

Field

Description

Example

TermGroup

Mandatory

Test

TermSet

Mandatory

Set 1

Term

Mandatory

Term 1

Level2

Optional

Term 1.1

Level3

Optional

Term 1.1.1

Level4

Optional

 

Level5

Optional

 

UpdatedTitle

Will not be populated during export. However required for any updates to existing title changes at any level above.

 

Url

If available will be populated during export.

 

FriendlyUrl

If available will be populated during export.

 

CatalogTargetUrl

If available will be populated during export.

 

CatalogChildTargetUrl

If available will be populated during export.

 

TargetUrl

If available will be populated during export.

 

ChildTargetUrl

If available will be populated during export.

 

LastModified

If available will be populated during export.

 

Action

Will be empty during export.

Add/Update

Status

Will be empty during export

 

  • The administrators can use Office Excel to open the CSV and perform changes.

Adding a new Term to CMS Managed Metadata Term Set

A new term can be added to the term set by adding a new line to the CSV file. The following example illustrates the new term named CPF Life 1 addition under the existing term Retirement

Field

Description

Example

TermGroup

Mandatory

Test

TermSet

Mandatory

Set 1

Term

Mandatory

Term 1

Level2

Optional

Term 1.1

Level3

Optional

Term 1.1.1

Level4

Optional

 

Level5

Optional

 

UpdatedTitle

Not Applicable for ADD

 

Url

Optional

 

FriendlyUrl

Optional

 

CatalogTargetUrl

Optional

 

CatalogChildTargetUrl

Optional

 

TargetUrl

Optional

 

ChildTargetUrl

Optional

 

LastModified

NA

 

Action

Required

Add

Status

NA

 

  • Every new iterm needs to be identified with the Action field as “Add”

  • A file can have both “Add” and “Update” items

Updating an Existing Term to CMS Managed Metadata Term Set

A new term can be added to the term set by adding a new line to the CSV file. The following example illustrates updating an existing Term 1.1.1 to Term 111

Field

Description

Example

TermGroup

Mandatory

Test

TermSet

Mandatory

Set 1

Term

Mandatory

Term 1

Level2

Optional

Term 1.1

Level3

Optional

Term 1.1.1

Level4

Optional

 

Level5

Optional

 

UpdatedTitle

Required only for Title Update

In case of updates to the below fields value for this field is optional

Term 111

Url

Optional

 

FriendlyUrl

Optional

 

CatalogTargetUrl

Optional

 

CatalogChildTargetUrl

Optional

 

TargetUrl

Optional

 

ChildTargetUrl

Optional

 

LastModified

NA

 

Action

Required

Update

Status

NA

 

 

  • In case of updates to a parent term, only the particular row on the csv needs to be updated and name on the child terms is not required to be updated.

  • Every update needs to be identified with the Action field as “Update”

  • A file can have both “Add” and “Update” items

Importing SharePoint Managed Metadata

  • The csv file this updated above can be imported into any termstore on any sharepoint farm with the script named ImportCsvtoMMS.ps1

  • Navigate to the file ensure the parameters central Admin Url and Managed Metadata services name are in par with the environment.

  • Login to admin server as farm admin

  • Open the powershell ISE as administrator

  • Open the ImportCsvtoMMS.ps1

  • Execute the script.

  • The script, upon completion generates a CSV file on the same folder where the script is located with the status information.

ExportImportMMS.zip

Comments

  • Anonymous
    January 12, 2016
    Hi Thiru, Could you copy and paste the script to export on this blog page please? We are unable to download .zip files Thank you Jay

  • Anonymous
    January 12, 2016
    Can I have your email id to send the zip?

  • Anonymous
    March 14, 2016
    The comment has been removed