Tuesday, February 16, 2016

Why you should back up your term store in SharePoint Online

Short version, if you delete a term, you cannot easily restore it.

But it is possible! (solution at the end of the article)
Yesterday our operations team were re-organizing some content on our Puzzlepart SharePoint Online tenant, moving subsites over to new site collections to support external sharing.

As some of these sites were using terms from term sets, we also wanted to move those. During the migration the migration tool, which happened to be ShareGate, gave some errors on some missing metadata fields. The migrator (you know who you are :-) figured: “Let’s delete the destination meta data and try one more time for good measure”. A variation of the very common: “Have you tried to turn it off and on again”.

Except, the term sets were global and not local to the source site collection. So when deleting terms on the destination location, effectively all source terms were deleted as well, and there is no log available on the terms deleted, nor a recycle bin.


In short the selected items in the right pane with all terms were effectively nuked – obliterated – they were no more, as were the ones in the left pane, as they were one and the same.

Let’s do a short intermission and provide improvement suggestions to ShareGate

The issue at hand is by no means ShareGate’s fault, but they have the power to stop us mortals from doing wrong :-) And this goes to all developers out there.
  • When trying to delete global objects, prompt a “Are you sure, as these objects may be in use other places”
  • If items on the source and destination are the same, give a warning like above
  • Add logging of items being deleted, which makes it easier to re-create

Let’s do another intermission and provide an improvement suggestion for Microsoft

Add a recycle bin to terms and term sets!!

Back to the story

I can only imagine the panic and sweat loss happening once it dawned on the migrator what had happened. I’ve done my share of screw-ups in the past, starting at the age of 13 with my first PC where I did a del *.* /q /s from c:\, or the time I tried to pull up a lost screw from the motherboard with a magnet. Both moments where the nanosecond after the deed I thought: “THAT WAS NOT SMART!! #¤%&”#”

So how did we go about fixing this?

As I’ve gotten to know SharePoint somewhat over the years I suggested to loop over the hidden taxonomy list which exists in all site collections (/Lists/TaxonomyHiddenList), and save out all the term labels, guids, term set guids etc. Then Tarjei suggested to look at some column definitions from sites we knew were using the lost terms and from the column name deduce what the term set names should be, as well as secure the term set id, as some of those were blank in the hidden taxonomy list.


Based on this, the operations team re-created term sets with the old id’s, as well as added terms to those term sets with the old id’s. And all is working again!
The drawback you might ask? Terms never been used have been weeded out, so perhaps not that bad.

Want to know more?

At Puzzlepart we now have term store backup in place and have added scheduled term store backup to our Assist365 offering. If you need help in securing and administering your SharePoint Online tenant feel free to head over to http://www.puzzlepart.com/assist365/ for more information on the Assist365 offering. We’ve experienced the pain!