Is there a way to overwrite the existing term set or will I only be able to add new terms to it manually? I have a csv file I used to import a term set. I recently added terms to that csv file and now want to update the term set with those new terms. However, when I upload the term set again, it doesn't overwrite the existing one, but rather creates a new one with a '1' appended to the name. Removing the old term set and adding the updated one with the same name does not work.
2 Answers
The Managed Metadata Service, which houses the term store (Groups, TermSets, Terms), is a farm-wide service. Any PowerShell scripts or .Net SharePoint API code that modifies any of these must be executed on one of the servers in the farm, whether it's a Console Application, Windows Form, Webpart, Application (ASPX) page, etc.
Overwriting (i.e. deleting and recreating) a TermSet can be a dangerous operation: the Guids behind the terms that actually associate site columns to Terms/TermSets will be destroyed, causing any existing site columns that are bound to the TermSet or any Terms therein to become dissociated. Bad news.
Although it is possible to preserve these Guids by various means, the code to do so isn't trivial, and I strongly suspect there's a better solution to your root problem.
If you've read this far, can I ask why you need to change the TermSet's Terms so drastically that you need to overwrite the entire TermSet?
you could use something like this
$spapp = Get-SPServiceApplication -Name "Managed Metadata Service"
$spguid = $spapp.id
$security = Get-SPServiceApplicationSecurity $spguid -Admin
Grant-SPObjectSecurity $security -Principal "Domain\username" -Rights "Full Control"
Set-SPServiceApplicationSecurity $spapp $security –Admin(Get-SPServiceApplicationSecurity $spapp -Admin).AccessRules
Another suggestion is sign DEPRECATED the old terms
-
Is there anything that can be done on the site itself? I don't believe we would have the access to do this without submitting a ticket to our help desk to have them do it for us. Commented Apr 18, 2013 at 17:57
-
1oh yes. You need to know what's the name of your MMD service and you need the permission to do this operation. BTW I don't think you need anything else. Commented Apr 19, 2013 at 7:33
-
To make sure I understand, something like the code you supplied would need to be applied (where?) and then we'd be able to overwrite the term set whenever needed with the updated one? Commented Apr 19, 2013 at 14:04