Search code examples
sharepointsharepoint-2010content-type

SharePoint: Add Columns to Content Types dynamicly


I use a SharePoint feature to programmatic add columns to an existing content type. This content type is already assigned to a list.

After I did that, the content type has those new columns, but the list is not updated (the new columns are not shown)

I could remove the content type from that list and add it again but would lose all data saved in the old columns.

Is there any best practice to add columns to an existing content type and update the list(s) that contain that content type?


Solution

  • The MS recomended way is to update CT through the Object Model. Please find links below.

    http://msdn.microsoft.com/en-us/library/aa543504.aspx

    All list content types are stored as entries in the SharePoint Foundation database because when you add a site content type to a list, SharePoint Foundation copies a site content type locally to the list as a list content type.

    http://msdn.microsoft.com/en-us/library/ms442695.aspx

    When you make changes to a site content type, you can push down those changes to all its child content types, either through the user interface or through the object model