Monday, May 31, 2010

Exception error message: "Given Key not Present in the Dictionary"

Last week I got two cases of this error on two separate SharePoint servers. The message is quite general, which doesn't help much. Luckily, after some struggling, the problems are all resolved!

The first one is on a SharePoint 2010 beta version server.

When I try to run SPMetal tool to generate the LINQ class file, I got the exception. In the end, it turns out there are two site columns with the same name and different data type defined in the root site and a sub site, which obviously confused SPMetal. After deleting the one in the root site, it works well.

The second one is on a SharePoint 2007 SP2 sever.

When a site collection backup is restored to the test server, I cannot open the site column gallery page any more.  It turns out that one site column is built based on a third-party field type. After installing that field type, everything back to normal.


There must be many other causes which can lead to this exception, I think we should spend more time to check the site columns.

Hopefully this post can save you some time.

No comments:

Post a Comment