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

I don't know why but when I try to bind a list with my content type, fields having a status to "Required" in my content type are not Required at all in my List.

I'm binding the field with this function :

function bindContentType($urlCollec, $xml, $lg){
Display-Info("Begin : Adding a Content Type")
$xmltypeContents = [xml](Get-Content $xml)
$typeContents = $xmltypeContents.contentTypes

foreach($typeContent in $typeContents.contentType){
    $url = $urlCollec+$typeContent.url
    $web = Get-SPWeb($url)

    $listTitle = GetValueByLanguage $lg $typeContent.list
    $list = $web.Lists[$listTitle]
    $webRoot = Get-SPWeb $urlCollection
    if($list -ne $null){
        $newCT = $webRoot.AvailableContentTypes[$typeContent.ctName]
        $list.ContentTypesEnabled = $true
        if($newCT -eq $null){
            Display-Error("The content type "+$typeContent.ctName+" does not exists")
            # Add the content type to the list.
            if (!$list.IsContentTypeAllowed($newCT)){
                Display-Error("The content type is not allowed on the list")
            elseif ($list.ContentTypes[$newCT.Name] -ne $null){
                Display-Warning("The content type name is already in use on the list");
                $addingnewCt = $list.ContentTypes.Add($newCT);
                Display-Success("The content type "+$typeContent.ctName+" was successfully added to the list "+$listTitle);

            if($typeContent.raz -eq 1)  {#Delete Associate type content 
                foreach($content in $list.ContentTypes){
                    if(!($content.Name -eq $typeContent.ctName)){

        Display-Error("The list "+$listTitle+" does not exists")
Display-Info("End : Adding a Content Type ")

Do you have some ideas where it can come from ?


share|improve this question

Grab the web version of the content type, grab the FieldLink (FieldRef) and update that.

e.g. in pseudo code:-

SPContentType contentType = web.ContentTypes[contentTypeName];
SPField field = contentType.Fields[fieldName];
contentType.FieldLinks[field.Id].Required = true;
share|improve this answer
Hey, I've tried this, but still doesn't work when I bind the list to the content type :s – Thoma Bigueres Jul 16 '12 at 8:54

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.