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")
}
else{
# 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");
}
else{
$addingnewCt = $list.ContentTypes.Add($newCT);
Display-Success("The content type "+$typeContent.ctName+" was successfully added to the list "+$listTitle);
}
$list.Update()
if($typeContent.raz -eq 1) {#Delete Associate type content
foreach($content in $list.ContentTypes){
if(!($content.Name -eq $typeContent.ctName)){
$list.ContentTypes.Delete($content.ID)
}
}
}
}
}
else{
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 ?
Thanks