I’ll be speaking at SharePoint Unite in Haarlem on Oct 26th

I’m excited to speak at the SharePoint Unite conference in Haarlem from October 24th to 26th. My session “Migrating your customizations from On-Prem to SharePoint Online” will be on October 26th. View the full agenda on https://www.sharepointunite.com/agenda.
You can register with a 20% discount using the promotion code SPKRKETM10.

My session abstract:
Are you working on migrations from on-prem SharePoint 2013/2016 farms to SharePoint Online? This session provides information about what you should take into account with regards to customizations that might be deployed/added to SharePoint. You can think about Full Trust Code, Sandbox Solutions, Workflows, InfoPath Forms, JSLink, and Provider Hosted Applications.
Also, based on a real-live migration, tips and tricks will be shared about what might/will break, if not mitigated properly.
This session will be relevant for everyone working on a migration to SharePoint Online, not only for developers.

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;

Managed Metadata and the Office Document Information Panel (DIP)

When you update any Managed Metadata column values from either CSOM of Full Trust Code, you need to make sure to make the Taxonomy value GUID lower cased. Otherwise it will cause the Office Document Information Panel to display an invalid default value (in red). Example code to update a default value, while ensuring the GUID is lowercased is shown below:

SPField field = SPContext.Current.Web.Fields["CustomMMSfield"];
TaxonomyField taxonomyField = (TaxonomyField)field;
TaxonomyFieldValue defaultValue = new TaxonomyFieldValue(taxonomyField);
defaultValue.WssId = -1;
// GUID should be stored lowercase, otherwise it will not work in Office
defaultValue.TermGuid = defaultValue.TermGuid.ToLower();
// Set the selected default value for the site column
taxonomyField.DefaultValue = defaultValue.ValidatedString;

Please note that the above code is Full Trust Code. Read this post to know how to set default values from CSOM.