Wednesday, April 27, 2011

Content Types in SharePoint 2010

It appears in 2010 when you have a boolean in your ContentType definition, the value MUST be in UPPERCASE.

In 2007, it respected any variation of True, true, TRUE etc. In 2010, you get no errors with having booleans in another case, it just does not work.

Monday, April 18, 2011

The object specified does not belong to a list

I started getting the "The object specified does not belong to a list" error on a SharePoint site I migrated from 2007 to 2010. The code I "inherited" worked fine in 2007 but raised an error in 2010.

After some investigation, the problem ended up being that an SPFile was constructed in a parent web instead of the web in which the actual file resided using SPWeb.GetFile(url).

So to fix the problem, make sure you construct your SPFile object (using GetFile anyway) in the SPWeb in which the file resides.

eg. if the file lives here: \ParentSite\SubSite\Pages\Page.aspx, make sure the SPWeb you are using is "Subsite".