SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using the sharepoint api to add field links to a content type, with code similar to the following:

AddFieldLink(siteField, contentype);    
contentype.Update(true, true);

I have specified true, in the update method to ensure that the field is mandatory. When I then edit an item of this content type in the UI will it ensure that this field contains a value i.e. will the field for this meta data be mandatory?

all the best

share|improve this question
up vote 0 down vote accepted

The update method is only performing the action of saving the changes to this content type (and optionally and children it may have), it does not set any properties on individual FieldLinks.

The first boolean in the update method will simply force the update to all child content types and the second one tells SP to throw an exception if it finds a child CT which it can not update.

You would need to set the required property on the SPFieldLink.

Dim fieldLink As SPFieldLink = contentType.FieldLinks(field.Id)
fieldLink.Required = True

This is also how you could set ReadOnly or Hidden properties for this field within your content type.

fieldLink.ReadOnly = True
fieldLink.Hidden = False
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.