Default column values and the Document Template

When you update the default column values for a content type, these new values are not pushed to the document template of the content type if you’re using a customized document template (e.g. mytemplate.dotx). New documents created using the document template will still have the old default values attached to it. To push the changes to the customized document template you can execute one of these steps:

  • Via the UI: Open the “Advanced Settings” page of the content type and click “OK”;
  • Via code: Get you SPContentType and execute this code (this simulates the UI step):
SPContentType ct = SPContext.Current.Site.RootWeb.ContentTypes[YOURCONTENTTYPEID];
ct.DocumentTemplate = ct.DocumentTemplate;
ct.Update(false);

Leave a Reply

Your email address will not be published. Required fields are marked *