Wednesday, 27 October 2010

Can’t remove a site column from a content type or list in SharePoint? Use PowerShell

There are particular site columns in SharePoint, which once added to a site content type or list cannot be removed again using the browser UI. An example of one of these columns in SharePoint Server 2010 is “Aliases”. If I add it to a content type and then click on the column name to remove it, you can see that the Remove button is not available.


This can cause much frustration and may even prompt you to completely delete the content type and start again – something that is usually impossible to do on a live environment.

Fortunately, we have PowerShell available to us for solving such problems. The script below will attach to the site containing your content type (also works for content type hubs), the content type itself, and then the link to the column within the content type. It then only takes a couple of lines to remove the column and update the content type.

The example below will remove the “Aliases” site column from the “Sales Document” site content type in http://portal:

#Attach to the web and content type
$web = Get-SPWeb
$ct = $web.ContentTypes["Sales Document"]

#Get link to the columnn from the web
$spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink ($web.Fields["Aliases"])

#Remove the column from the content type and update

#Dispose of the web object


Note that any columns of this type deleted from a parent content type will not automatically disappear in the child content types below it. The easiest way to get around this is to use the same script above to remove the site column from child content types, too.

Unfortunately, you may also find that if the content types containing this site column were attached to lists, then the lists themselves will also have the column added to them – even after removing the column from all associated content types. If this is the case, you will not be able to remove the column in the list using the browser UI as the Remove button will be missing on the column administration page here also.

To resolve this, you can either decide to remove the column using PowerShell one list at a time, or if there is a way of defining a batch of lists, use a script to modify multiple lists in one go. The script below provides you with an example of how to walk through each document library of a specified name on each site of the site collection and delete the offending column. If you do decide to run a script like this, please ensure you have fully tested it in a development environment beforehand due to the potential damage that it could inflict:

#Delete column on a specified list in all sites of a site collection
$site = Get-SPSite http://portal
$site | Get-SPWeb -Limit all | ForEach-Object {
    #Specify list which contains the column
    $list = $_.Lists["Pages"]
    #Specify column to be deleted
    $field = $list.Fields["Aliases"]
    #Allow column to be deleted
    $field.AllowDeletion = $true
    #Delete the column
    #Update the list


  1. When I try to run "$spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink ($web.Fields["Aliases"])" in PowerShell, I get the following error: Constructor not found. Cannot find an appropriate constructor for type Microsoft.Sharepoint.SPFieldLink.

    Any idea on why I am gettting this error? I have the SharePoint snapin installed.


    1. This modified script works for those columns that are not visible/editable.

      #Attach to the web and content type
      $web = Get-SPWeb http://portal
      $ct = $web.ContentTypes["Sales Document"]

      #Get the fieldLink (optional check for existence)

      #delete the fieldLink

      #true here, as stated in one of the last comments, will push changes to children.
      #Dispose of the web object

    2. Thanks, this worked for the Active ("RoutingEnabled")column

  2. Hi - try removing the space between SPFieldLink and ($web.Fields... for example:

    $spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink($web.Fields["Aliases"])

    It could be a syntax error with my script.

  3. Tried it with and without the space and it works for me, so not sure...

  4. I ran into the same issue. Some columns imported, others did not. In looking through the XML output, I noticed that the columns that did not import either were from a Feature that needed to be activated or were from a Custom Site Column. Check out Phil Childs's post on "Export and import/create site columns in SharePoint using PowerShell" to fix the issue. (

  5. I have a site that has a large number of subsites and libraries under it. I am trying to remove a content type from the site collection, but there are 6740 libraries(yes, really) that have the content type assigned to them.

    Is there a way to remove the content type on a mass scale from the libraries via Powershell for WSS/2007?

  6. Josh - I have a couple of articles on removing content types from documents ( and then lists ( which you would have to do before removing it from the site collection. You shoukd be able to convert the scripts to work with SP 2007 by looking at this article:

    Good luck!

  7. in your first script block, i believe adding $true to the update method will push the changes (deletion) to all the child content types:


  8. Saved me :-) Thanks Phil

  9. I am very new to PowerShell and can't get this command to work with SharePoint 2007, would any kind soul out there have a version that they have used successfully in 2007 that they'd like to pass on? Many thanks in advance.

    1. Anonymous - PowerShell is only available in SharePoint 2010+
      I am not aware of a STSADM command that does the same...

  10. Just thought I'd let you know that further to my query above I managed to fix this problem by using "SharePoint Manager 2007" from Codeplex. This tool allows you to navigate down to a field and change the AllowDeletion property to True. Then when you go to the column properties the Remove button is available and you can delete in the usual way.

  11. I've eights site columns under group "E-mail Submission Columns". Each columns shows up three times in the list. The site column is not in use under any content type. Email Submission CT was removed.

    I don't see delete option for these 8 site columns! How can I use your script to accomplish that?


  12. Thanks Phil.this saved my day.I was struggling to remove the site columns from the doc.lib references and its associated content types. You code helped me to fix that and worked like a charm.You are doing a great job helping the SP developers like me and making our life easier!
    Thanks Again!

  13. Today, we get a first look at the adidas Tubular Invader 2.0 that will be debuting as part of adidas Originals’ Fall/Winter 2016 Collection.The adidas Tubular Invader 2.0 is a street-ready silhouette that yeezy boost 350 has a sporty style. This 2.0 version of the Tubular Invader is a strap-free model that features full grain leather yeezy shoes uppers with dramatic cut on the collar and snakeskin embossed heel panels. Completing the look is a soft EVA midsole adidas nmd R1 and rubber outsole.Check out these two upcoming colorways in “White” and “Black” below and look for either of them available Yeezy Boost 350 Turtle Dove today through select adidas Originals retail stores, including shops like like The Good Will Out.
    The adidas Ultra Boost “Triple Adidas Yeezy Black” is expected to take the popularity of the adidas Ultra Boost silhouette to the next level.Reason being, it’s the adidas nmd first release to feature an all-Black Boost cushioning sole on the adidas Ultra Boost silhouette. Matching the Boost sole is NMD Human Race Yellow an entire all-Black upper that includes matching Blackout laces, heel counter, and cage overlay.Look for the adidas Ultra Boost “Triple Adidas Shoes Black” to release this holiday season at select adidas Originals retail stores. The retail price tag is set at $180 Adidas Basketball Shoes USD.
    For Fall 2016, adidas Originals will be introducing their latest adidas NMD XR1 Camo Pack that consists of two adidas stan smith adidas NMD XR1 colorways.Dressed in either Black or White, both adidas NMD releases features a camouflage graphic atop a mesh adidas shoes constructed upper. The “White Camo” pair features a Black heel tab and matching Black rubber outsole. While the “Black Camo” Yeezy Boost 350 edition sports a White heel tab and White rubber outsole. They’re both completed with a full-length White Boost midsole.Check out Adidas Ultra Boost


  14. The share your really gives us excitement. Thanks for your sharing. If you feel tired at work or study try to participate in our games to bring the most exciting feeling. Thank you!
    hotmail sign in | red ball 1 |

  15. Thanks for sharing amazing information !!!!!!
    Please keep up sharing.

  16. اليوم اقدم لحضراتكم شركة من افضل الشركات التي تقوم بخدمات التنظيف والنظافة الشاملة بالسعودية
    شركة الصفرات معروفة بانها الافضل والارخص والاخسن عن غيرها
    فيوجد شركات عديدة وهمية احذركم ان تتعاملو معها
    فشركة الصفرات شركة رسمية ولها مقر وتمتلك فريق عمل واداره
    وقسم للشكاوي وضمان الخدمة
    شركة الصفرات لتنظيف المجالس
    يوجد الكثير من المواقع الالكترونية التي تستخدم اسم شركة الصفرات
    فنحن ليس لدينا اي صلة بتلك الشركات نهائيا
    فشركة الصفرات الرسمية التي تمتلك الموقع التالي فقط
    اضغط علي الينك لفتح الموقع وللاستفسار بصوره كاملة عن خدمات شركتنا
    شركة الصفرات لتنظيف الموكيت

  17. شركة الصفرات لتنظيف بالبخار
    جميعاً ندرك أن التنظيف ضمن أهم الأشياء التى نقوم بها و بالشكل الدورى تجأة الأماكن والأشياء التى الصفرات للنظافة نملكها ونتعامل معها مثل الأثاث والمنزل والفنادق وغيرها الصفرات لتنظيف الخزانات من الأشياء مثل السجاد والموكيت كل هذا يعنى أن التنظيف خيار لا بديل عنة ولا يمكن الأستغناء عنة لهذا فأن العمل على التطوير من الطرق الصفرات لتنظيف الموكيت المستخدمة والأسهل والأسرع ذلك السبيل الأول من أجل الحصول على الأفضل و الأسرع فى الصفرات لتنظيف المنازل عالم التنظيف أن البخار يعتبر من أكثر العناصر التى تقدم لنا النتائج الأفضل المبهرة والتى من شأنها القضاء على الفيروسات والجراثيم من على الأسطح الصفرات لتنظيف المجالس و الأرضيات و مع الأستمرار فى تلك العوامل ومع التطوير من قدرات العمالة يصبح الأمر الصفرات لتنظيف الشقق أفضل دائما و يسير ناحية الخيار الأفضل والأهم أن شركة الصفرات لتنظيف بالبخار ترسم دائما الأسس و المعايير التى تجعلها الأولى شركة الصفرات للتنظيف فى المملكة و الأوسع أنتشاراً وذلك لآنها تعتمد على قوة البخار المذهلة و الكبيرة الصفرات لتنظيف المسابح و التى تطهر و تعقم الأسطح و الأرضيات و غير ذلك الكثير
    من خدمات الشركة عمليات نقل الاثاث ايضا تتم من خلال عمالة مدربة وسيارات مغلقة للحفاظ علي الصفرات لنقل العفش الاثاث من اشعه الشمس اثناء النقل نتميز بالجديد في هذه العملية خبره في نقل العفش والعمل الصفرات لنقل الاثاث علي تغليفه ونقله

  18. También puede visitar una tienda de ladrillo y mortero de Michael Kors o su sitio web y comprar directamente un bolso Michael Kors desde allí. Usar un bolso de Michael Kors les permite a los demás reconocer que el habitante urbano educado toma la moda realmente con seriedad. Los bolsos de hombro son particularmente refinados y elegantes.

    {Bolsas Michael Kors Precios | Bolsos Michael Kors Outlet | Michael Kors Rebajas}

    En vacker konstnärlig skapelse av vävt läder, som ger ett skalskaligt utseende - liknar en snakeskin eller fiskhud, linjer utsidan av påsen. Läderens bältros är små läderringar. Det finns också gyllene accenter på väskan. Slutresultatet är svagt liknar kedjepost.

    {Michael Kors Rea | Michael Kors Väska Rea | Michael Kors Plånbok}