共用方式為


Backup/Restore-SPSite and the Missing Term Set!

One of my customers recently wanted to move a Site Collection into a new Content Database, however instead of using Move-SPSite to do this they decided to use Backup/Restore-SPSite and here is where the fun began! 

One of the key differences between using Move-SPSite and Restore-SPSite is that Restore-SPSite will assign a new GUID to the Site Collection as part of the restore process, one of the results of this is that the Site Collection Term Set will lose its mapping and will be in-accessible - the reason for this is that the ACL for the Term Set uses the Site GUID and if the Sites GUID changes, it will not have access to its Site Collection Term Store.

The result of this for my customer was that the Site Collection Term Set vanished and was inaccessible when the Site Collection that had been restored, fortunately this is fairly easy to resolve using the steps below:

  • Determine the GUID (UniqueId) of the Site Collection Term Set - This can be obtained by querying the MMS Service Application database. In the example below the Site Collection was named "qwerty".

  • Execute the following script - Replacing TermSetGUID with the UniqueId obtained in the step below and SiteURL with the URL of Site Collection that you need to grant access to the Term Set. Please run with an account that has "Full Control" permissions on the MMS Service Application and is a "Term Store Administrator"

asnp *sharepoint* -ea 0
$TermSetGUID = "TermSetGUID"
$Site = Get-SPSite "SiteURL"
$TermSet = Get-SPTaxonomySession -Site $Site
$Group = $TermSet.DefaultSiteCollectionTermStore.Groups | Where {$_.Id -eq $TermSetGUID}
$Group.AddSiteCollectionAccess($Site.Id)
$Group.TermStore.CommitAll()

Brendan Griffin - @brendankarl

Comments

  • Anonymous
    September 04, 2015
    Thank you for this article!! We ran into exactly this scenario, and this successfully got us out of this jam :)
  • Anonymous
    December 03, 2015
    The comment has been removed
  • Anonymous
    December 03, 2015
    Hi

    It look like only can appy on same machine, but if restore the site to other machine, how recovery the term store for the site to use the old term store setting with config.

    Regards
    PK
  • Anonymous
    December 07, 2015
    The comment has been removed
  • Anonymous
    December 14, 2015
    Thank you, Brendan Griffin
    Do you have any detail solution let me try.