Wednesday, March 9, 2011

Exceptions when creating site columns based on local term sets

This blog is about a little known bug in SharePoint 2010. The bug manifests as follows:

When creating a new site column of the managed meta data type, and you select "customize your term set", you are presented with one of the following errors:
- This operation cannot be completed. The term store may be unavailable.
- Failed to read from or write to database. Refresh and try again. If the problem persists, please contact the administrator






Reason

When you create a site column, the first field is the title. This field is required, but you can start filling out the rest of the form before entering the title. When you choose "Managed Meta data", and then "Customize your term set", an empty term set is directly created for you. This term set is titled "Untitled". This term set is stored in the managed meta data service. Even when you rename the term set afterward, and give the site column a proper name, a reference to this "Untitled" site column is kept, linked to the url of your site collection. You can see this when you create a new column, and again don't specify a title. The suggested title for your term set will be "Untitled_1".

As long as you keep your site collection, this is not a problem. However, when you delete this site collection and create a new site collection at the same url, this reference causes problems. Because it was stored in the service application, it was not deleted.

It is always in the way when you try to create new site columns with customized term sets.


Solution

The only solution I found is creating a new Managed Meta data Service instance. You might want to delete the old one, with the corrupt data, but based on business needs this may not be an option. Remember to configure the new Managed Meta data Service instance with "This service application is the default storage location for column specific term sets" set to true:





If you don't, you'll get the following error:
"The default term store for this site cannot be identified"

Update: The first service pack for SharePoint contains a fix for the following problem:
- If a user creates a site collection, deletes it, and then re-creates the site collection by using the same name, the site collection group is not re-created in the term store.
If I'm not mistaken, this is a fix for the bug described here.

4 comments:

  1. Had the same problem, fixed it by programmatically deleting the orphan TermGroup

    ReplyDelete
  2. That sounds like a great solution. Can you provide the code for it? Would like to try and put it in a PowerShell script.

    ReplyDelete
  3. Please see http://sharepoint.microsoft.com/Blogs/fromthefield/Lists/Posts/Post.aspx?ID=139 for a listing of a PowerShell function that can be used to deal with this issue.

    Also, I'm sorry to say that Jan has misdiagnosed the issue slightly, as it has nothing to do with those 'Untitled' term sets - please see the post referenced above for details...

    ReplyDelete
  4. Hello Sergey,

    Thanks for your comments. You appear to be right about the underlying reason. I hope this problem is a thing of the past with the first service pack for SharePoint.

    ReplyDelete

Rating