Saturday, 26 June 2010

Create a new SharePoint site column using PowerShell

The script below can be used to create a new site column. It assumes you are creating the column in the top-level site of a site collection. It can be used to create columns in a Content Type Hub site, which can then be propagated to other site collections in the farm using the Managed Metadata Service Application (a story for another blog article maybe).

The main advantages of using PowerShell to create the site column are that you can document the changes, easily repeat them across development, staging and production environments, and you can set some properties that are not available to select in the UI (e.g., the “ShowIn” properties at the end of the XML string).

#Assumes that you are creating the site column in the top-level site of a site collection
#Script can also be used to create a site column in the Content Type Hub

#Get site and web object
$site = Get-SPSite -Identity "http://portal"
$web = $site.RootWeb

#Assign fieldXML variable with XML string for site column
$fieldXML = '<Field Type="DateTime"
Description="This is a test date column."
DisplayName="Test Date"
Group="Test Custom Columns"

#Output XML to console
write-host $fieldXML

#Create site column from XML string

#Example of changing the site column settings after creation
#Configure Test Date column to be Date Only instead of Date & Time
$dtField = $web.Fields["Test Date"]
$dtField.DisplayFormat = "DateOnly"

#Dispose of Web and Site objects

Note at the end of the script that I call the new column back so that I can change a setting. You could add column settings to the XML during creation, but changing it after creation can be useful if you have already created the column and wanted to make further changes.


  1. This came in handy in my situation

    In the change settings:

    $dtField.PushChangesToLists = "TRUE"

  2. Hi. I used your script to create my site column. I mistyped my field type as 'choice' instead of 'Choice' and that corrupted my site columns page under site settings. Is there any way I can delete my site column again using a powershell script? I can't delete via UI or SharePoint Designer. Thanks.

  3. Try this:


  4. Or this if it is a site column:


  5. Hi Phil

    I have the same question as Anonymous above.
    A typo caused my site settings column page to error. I created a custom column but haven't used it in any content type, workflow or list yet. How can I delete it from my site columns?

    Thanks in advance!

  6. Hi - Use the UI to delete the column or following the links I posted above

  7. I can't access the UI pages, so can't delete them over there.
    The links show an example of deleting a column from a specific content type or list, which I don't have.

    Could I do something like this:

    $web = Get-SPWeb http://portal
    $spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink ($web.Fields["MyCustomField"])


  8. Try this:

    $web = Get-SPWeb http://portal
    $column = $web.Fields["Bad Column"]

  9. I'm getting a null value.
    Investigating why, I'll let you know if I find the problem.

    Thanks for your feedback.

  10. how this site column created can be referenced to a list using powershell

  11. Use SharePoint Manager 2010?

  12. Thanks! I am working on a script to read parameters from a file and build a set of site columns. Your script is very helpful. - Doug

  13. hi , I have a custom site column called 'reviewed' and this field type is 'checkbox'. we are referring this field in 30 contenttypes. these cotent types associated to 10 document libraries. now i want to change this field type to
    choice - dropdown , with required field option.

    how can i change 'type' of existing site column using powershell ?

    i tried to use below powershell luck

    $field =$RootWeb.fields.getfield("test1")
    $field.Type= "Choice"

  14. With havin so much written content do you ever run into any problems of plagorism or copyright violation?
    My site has a lot of unique content I’ve either authored myself or outsourced but it seems a lot of it is….
    popping it up all over the internet without my agreement.
    Do you know any solutions to help prevent content from being ripped off?

  15. I’ve been browsing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the web will be a lot more useful than ever before.

  16. Thanks for sharing superb informations. Your web-site is very cool. I am impressed by the details that you have on this blog. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found just the info I already searched everywhere and simply could not come across. What a great web-site.

  17. Nice stuff, but don't you need an ID field ?

  18. After I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now every time a comment
    is added I recieve 4 emails with the same comment. There has to be an easy method you can remove me from that service?
    Thank you!

  19. Hi! Do you know if they make any plugins to assist with
    Search Engine Optimization? I’m trying to get my blog to rank for some
    targeted keywords but I’m not seeing very good results.
    If you know of any please share. Thanks!

  20. is a online divorce resource for divorce attorney, attornies and lawyers. You will find the best divorce information online. Divorce Mind will make your divorce or separation a quick, convenient and private....

  21. Saya pribadi selalu mencari nafkah lewat taruhan bola on-line. Jujur saja dalam sehari saya dapat memperoleh minimum 200 ribu rupiah. Ini merasa begitu gampang sekali. 200k rupiah di kalikan dengan 30 hari yaitu 6 juta rupiah. Benar-benar cukup untuk saya untuk hidup melalui hari. agen sbobet.Sudah pasti untuk mengais rejeki di bagian taruhan bola on-line tidaklah hal gampang untuk pemula.

    Stay selalu di situs (blog) saya seandainya anda menginginkan menuntut pengetahuan perjudian on-line yang hasilkan kemenangan. agen sbobet. Beberapa hal perlu yang perlu diperhatikan diantaranya yaitu mencari agen bola sbobet yang legit atau terpercaya. Artikel saya kesempatan ini yaitu pengalaman saya selamA 1 th. 2 bulan menempatkan taruhan bola dengan website agen sbobet terpercaya agen sbobet Saya ringkaskan dalam judul Review Agen Sbobet Terpercaya. agen sbobet. Hal apa sajakah yang buat saya kerasan bermain dengan agen sbobet ini? Simak berikut ini.

    agen sbobet Melayani Mulai sejak 2013

    Sudah pasti dalam pilih agen bola yang dapat diakui yaitu lamanya berdiri website itu. agen sbobet adalah satu diantaranya. agen sbobet. Pertama sekali saya daftarkan diri, sesungguhnya terbesit kesangsian apakah agen yang satu ini legit atau tidak. Saya check lewat internet mengenai berapakah lama usia domain itu. Nyatanya telah mulai sejak 2012 domain agen sbobet terbeli. Ini sedikit menghapus kesangsian saya yang semula muncul. Simak video pendaftaran anggota berikut ini.

    Service Customer Dukungan Yang Memuaskan

    Saya lalu buka chat dengan menyebut Customer Service mereka lewat Live Chat. Kesan pertama yaitu kesopanan. Cs itu lalu dengan friendly menerangkan profile website agen mereka. Lalu beliau menerangkan mengenai langkah mengolah transaksi, langkah lakukan penarikan bila saya menang, serta pastinya grade tiap-tiap product. Dalam hal semacam ini,
    agen sbobet. saya pilih Sbobet untuk taruhan bola on-line. Selesai pendaftaran, saya lalu coba membulatkan tekad kirim dana sebesar minimum deposit sesuai sama ketentuan website agen sbobet. Sesudah lakukan penelusuran grade apa yang saya dapatkan dalam user id Sbobet , nyatanya benar sekali.

    User Sbobet saya peroleh grade A. Ini sesuai sama apa yang tercantum di dalam website mereka. Kejujuran yaitu hal paling penting dalam melakukan bisnis taruhan on-line.
    agen sbobet. Website ini memberi kesan itu pertama kalinya mengunjunginya. Cs yaitu orang yang paling dekat dengan player.
    agen sbobet. Customer Supportlah yang melindungi data diri pemain aman dari segalanya jelek. bola tangkas Hargai mereka.


  22. I don't apperceive what it is about the bendable blow and matte finish, but I accept a anemic atom for printed suede Christisn Louboutin Outlet. One of the best brands to cull this off is YSL Wallet Outlet. I accept to acquaint you about a backpack attraction of mine. I am in fact mad at myself that I did not splurge on the Ralph Lauren Polo Outlet Croc Muse Two which has two colors that I admire with a sueced croc pattern. To see a formed suede accomplishment off a Red Bottoms Outlet that I already adore, my affection melts. Replica Watches are additionally pretty reflective of their user's persona. Amazing furthermore multi-colored Replica Watches are commonly worn because of the younger. Conversely, exquisite dress Swiss Rolex Replica are regularly sported by highly developed gentlemen. And then usually there's the luxurious Swiss Replica Watches worn by the individuals who're properly to complete. Check out observing your mates furthermore you can before long see how the layouts are actually ranging.

  23. It is a time consuming process to locate a legitimate, high-quality designer Michael Kors Handbags On Sale at a decent price. One brand name that is sought after is the Michael Kors Bags On Sale. Anywhere you see high demand you will find people out to make a quick buck.

  24. There are those who want to collect vintage items like Michael Kors Factory Outlet with genuine and high quality leathers from Michael Kors. To be able to grab a quality Michael Kors Bags Outlet item of your choice, make sure to be very careful in selecting what to buy, how to buy and where to buy the Michael Kors Outlet Online.

  25. Thanks for the information, this is very useful. Allow me to share a health article here, which gods are beneficial to us. Thank you :)

    Cara Mengobati fistula Ani
    Obat Bruntusan Herbal

  26. This article is interesting and useful. Thank you for sharing. And let me share an article about health that God willing will be very useful. Thank you :)

    Obat Sakit Kepala Berputar (Vertigo)
    Pengobatan Polip di Usus tanpa Operasi
    Obat Herbal Batuk tak Kunjung Sembuh

  27. This article is interesting and useful. Thank you for sharing. And let me share an article about health that God willing will be very useful. Thank you :)

    Obat Herbal Sakit Kepala Menahun
    Obat Alami sakit Telapak Kaki

  28. The article is very interesting. And I also want to share articles about health, I'm sure this will be useful. Read and share it. Thank you very much :)

    Obat Koreng Menahun
    Obat Scabies Herbal
    Penyebab Kurang Subur/Susah Hamil
    Obat Mata Bintitan dan Gatal

  29. Thank you for sharing the information. See also information from us through the following article! Thank you :)

    Obat Dermatitis Atopik Herbal
    Obat Herbal Tremor/Tangan Gemetar
    Cara Mengatasi Menstruasi yang Berkepanjangan

  30. "Your interesting post invites you to see my post at FMovies

  31. I really enjoyed your post and I will learn by inviting you to see my post at

  32. "What a great idea to invite me to see my post at Yesmovies

  33. "Good ideas, good investment content, please go to the car I just posted at SolarMovie

  34. I really enjoyed your post and I will learn by inviting you to see my post at 123Movies

  35. Coach Bags On Sale Online examples generally useful 2020 Jordan Release Dates for musical, and other time aware, interactive applications.. New Black Yeezys

    AbstractBackground: Michael Kors Bags Sale Over recent years, wide ranging changes have occurred in undergraduate medical curricula with reduction of hours allocated for Ray Ban Round Sunglasses teaching anatomy. Anatomy forms the foundation of clinical practice. However, the challenge of acquiring sufficient anatomical knowledge in undergraduate medical education for safe and competent clinical practice remains.

  36. You got to Coach Outlet Clearance Sale stick to something that works. If your solution to make your company work is to add more products, then that bad. I really just think you are hipster for camping. They also are valuable screening tools in helping to detect potential problems, including some birth defects, placental issues, breech positioning, and others. Many expectant Cheap Nike Air Force 1 parents look forward to learning the sex of their babies via ultrasound midway through a Coach Outlet Purses On Clearance pregnancy. And later in pregnancy, doctors can even use ultrasounds to estimate how large a baby is just before delivery..

    How serious is it if the rear differential Coach Outlet Online 80 OFF is leaking oil?Pretty serious if it is leaking badly. Depending on different models of vehicle rear differentials, are very expensive to repair and replace. Honestly, if you are mechanically inclined you can grab yourself a gasket and your specified differential fluid at your local MK Outlet Sale autoparts store.

    Physical fitness is assessed through a test known as the Candidate Fitness Assessment which consists of a kneeling basketball throw, Jordan Shoe Stores pullups, situps, pushups, and a 1 mile run. While the Academy does not publish minimum scores for this test, I believe there are minimums in each area which must be met. Averages for appointees are published, so it is best to meet or exceed all published averages to be highly competitive..

    In another encounter, Joan reportedly discovered Christina's clothes hanging in a closet on wire hangers, instead of higher quality crochet hangers, and reprimanded her harshly. In an incident in which Christina refused to eat very rare beef, Joan ordered the meat returned to the refrigerator and refused to allow Christina any other food for several MK Outlet Online days until she finished the meal, but Christina managed to hold out until her mother gave up and allowed her regular meals again. Joan allegedly disposed of her children's possessions to punish Cheap Air Forces them for minor transgressions.