Monthly Archives: January 2012

SPException “The collection cannot be modified.” when calling SPContentType.Update()

If you are getting the SPException “The collection cannot be modified.” when calling SPContentType.Update() then ensure that the content type you are updating was not┬áretrieved from the SPWeb.AvailableContentTypes collection. Content types retrieved from this collection (as oppose to SPWeb.ContentTypes) are … Continue reading

Posted in Content Types, SharePoint, SharePoint 2010 | 7 Comments

Adding Browse button to pick a document when creating Link to a Document

The OOTB Link to a Document content type is quite neat. It allows you to create a link to documents in other locations in your site. External links are also possible. The user experience is quite poor. The user either … Continue reading

Posted in SharePoint 2010 | 7 Comments

Null reference exception when adding content type to document library at Microsoft.SharePoint.SPFile.UpdateInternal

I was adding content types to a document library using C# and got a Null reference exception when calling SPList.ContentTypes.Add(contentType). The stack was: My code to add the content type was fairly innocent: It turns out that it was because … Continue reading

Posted in SharePoint 2010 | 1 Comment