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 ?


1 Answer 1


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;
  • Hey, I've tried this, but still doesn't work when I bind the list to the content type :s Jul 16, 2012 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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