0

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.

  • Can you include a powershell code please? – Aziz Kabyshev Feb 24 '16 at 18:34
  • It is just a usual powershell script to deploy and install the solution. The issue is not comming from there because I did not touched it. And it was working perfectly since several months. Basically, I just want to remove this corrupted column from my site. – ameliapond Feb 24 '16 at 18:38
  • I don't quite get "cannot be found" part. Does that column show up in (Get-SPSite $url).RootWeb.Fields | Select Title,InternalName,Type | more? – Aziz Kabyshev Feb 24 '16 at 18:44
2

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()
  • Thank you for your answer. I tried your method and as expected I got the classic "Site columns which are included in content types or on lists cannot be deleted. Please remove all instances of this site column prior to deleting it." Any other suggestion ? – ameliapond Mar 1 '16 at 15:09
  • Hi @ameliapond. I've edited the script to handle fields that are referenced. This will first delete the site column from all site content types, then from all lists. – Aziz Kabyshev Mar 1 '16 at 15:49
  • Hi @Aziz ! I still get the same message after updating my script with your update. However, the ugly message (the one in visual studio) is not displayed anymore when opening the list instances, list definitions or content types. I made some iireset and sharepoint timer service restart at the same time. Note: when my field were corrupted the native SP fields were writen in a strange format. It was something like $Resources:core;ID for instance. Even the view name had this format. Nevertheless, thank you very much. – ameliapond Mar 1 '16 at 17:04
  • $Resources: means string's loaded from resources. It's the way modern UI is implemented, that is multilingual - SP loads strings like "Title" and "Titre" from corresponding resource for each user. That's why you've used InternalName in powershell - it never changes. Anyway, glad to have been of service – Aziz Kabyshev Mar 1 '16 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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