سؤال

when opening my content type designer I get this message:

enter image description here

"Unable to get data from the SharePoint server. The designer will only display data from the local project. You can try to reopen the designer to recover data from the sever."

It's related (I'm sure about that 100%) to a corrupted column that I have created then deployed with a typo in the Type attribute of this column. Now I can't even get access the site columns page because I get the following message :

"Field type ... is not installed properly. Go to the list settings page to delete this field"

I have already tried to remove it using powershell but the column cannot be found. I don't want to see this message anymore and get that corruputed column out of my site. Thank you.

هل كانت مفيدة؟

المحلول

Find that column's InternalName in the output of (Get-SPSite $url).OpenWeb().Fields | Select Title,InternalName,Type | more, and put it as $fieldInternalName in the next script:

$url = ...
$fieldInternalName = ...

$w = (Get-SPSite $url).OpenWeb()

$w.ContentTypes | % {
    $fieldInUse = $_.FieldLinks | Where {$_.Name -eq $fieldInternalName }
    if($fieldInUse) {
        $_.Name
        $_.FieldLinks.Delete($fieldInternalName)
        $_.Update()
    }
}

$w.Lists | % {
    if($_.Fields.ContainsFieldWithStaticName($fieldInternalName)) {
        $fieldInList = $_.Fields.GetFieldByInternalName($fieldInternalName)
        if($fieldInList) {
            $_.Title
            $fieldInList.AllowDeletion = $true
            $fieldInList.Delete()
            $_.Update()
        }
    }
}

$w.Fields.GetFieldByInternalName($fieldInternalName).Delete()
$w.Update()
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top