Tuesday, April 21, 2015

Deleted Term Set in SharePoint Online - consequences and solutions

One of our clients has accidentally deleted a whole Term Set from their SharePoint Online tenant.
The term set was mostly reusing some terms from other Term Sets, and had just one unique term.
There is one column in one document library, which was linked to that Term Set and about 2600 documents in that library that have a term assigned from that Term Set.


  • Due to the fact the column is "Required" people can no longer upload documents to the library. Whenever you go to the upload form, the field for this columns is simply greyed out (as it's linked nowhere). The "Documents" column is the one that has the issue in our example:

  • Whenever you try to filter by that column by any of the terms, you get no results although there are plenty of documents with the same term assigned. Imagine you filter by a value that you already see jus underneath the filtering button, and boom - you get nothing:


  • Restore.

Bad news. You can't restore anything from the Term Store in SharePoint Online. Support call to Microsoft did not help either, you need to have a 3rd party solution in palce that can export your term store. I found this one  but it's a manual, on-demand export process, there's no automation option.
Another downside is that this is not a free software either.

  • Recreate.

That's what we've done - recreated the Term Set immediately after we've found restore is not an option. We've also reused the terms again (they were not that many - around 20). If you don't know which terms were used, unfortunately you'll have to look at the items in the document library and see what's already assigned to the items (manual process, takes a lot of scrolling...).

Let's say you've gone through the painful process of srolling through some ~2600 documents to get a full list of your terms, so now your Term Setrecreated, full of terms, and you've lost nothing rather than those 30 minutes (could be more or less) depending on how many documents and terms you've got. Wait, was it that easy? No... let's go to the filtering once again.

Doesn't work, of course. Term Sets have their own GUIDs and once you've deleted your Term Set, you've lost that GUID forever. Even if you knew it, you can't manipulate the GUIDs of any Term Sets, as they're automatically generated.

So, how do you handle that? You've got 2 options....

1. Go to the Quick Edit view in the library and start tagging the documents manually with the same terms (they're considered new terms as they reside in a new Term Set). 2600 documents - that would take quite some time.... half a day or a day, maybe. 

2. Smarter option. Create a list view, filtered by that managed metadata column and use one term as a start. That'll give you the documents that have this term assigned, and now you can remap the term for all the documents that have it assigned (or almost all, read further on to find out why). The first thing to do is verify those two options for your document library. 

  •  Don't require documents to be checked out before they can be edited.

  • And allow items in the document library to be edited using Quick Edit

Then... create your view fo the first term...imagine if the impacted column name is "Subscriber ID" and one of your terms assigned to hundreds of documents is called "Test".

The quick Edit view button can't be missed - it's the second button in the ribbon, right next to "View".

Select all the items in the view and then you click on the almost invisible managed metadata button on the left side of the term name. Then you have the option to choose "Replace all selected values with these terms", you choose the same term from your new term set (or any other one if you've changed your mind about what those documents should be tagged with) and click OK. Once you do that, you'll see SharePoint is "Working on it..." 

You are very likely to end up with this little message. I've raised it with MS and they've advised that the "Quick Edit" view is limited to 100 items.. although I could actually open it and see all of the 2600 items in our document library.

My personal tests have concluded that it only works with changes for up to 50 items maximum in the view... and I had a few occurences of the issue even with just 50 item, so had to reexecute the update or use less items - 25 was working perfectly for me.

That's it, with about 1 hour of retagging the documents we're back in business. 
Outcome: Be extremely careful with your Term Sets.