Monday, October 3, 2011

Adding Text Fields to a List

You can use Windows PowerShell to add Text fields to a List in SharePoint 2010. Simply use the Add() method available on a fieldcollection. The example below demonstrates how to add a Text field to the Tasks list, set a Description and set the field as required. Note that the Add() method allows us to specify the Fields Name, the Type of Field and a Boolean value that determines if the field should be required.

PS > $spWeb = Get-SPWeb http://SP01.powershell.nu

PS > $spList = $spWeb.Lists["Tasks"]
PS > $spList.Fields.Add("Text Field","Text",$true)
PS > $spList.Fields[“Text Field”].Description =My Custom Text Field
PS > $spList.Fields[“Text Field”].Update()
PS > $spWeb.Dispose()

1 comment:

  1. visual studio 2012 ultimate cd-key , windows seven ultimate product key , microsoft office home and student 2010 usb , office 2013 activation keys , ms office professional 2010 genuine key download , windows 10 product key a , windows 7 pro key sale , how to purchase genuine windows 7 , sSss5n

    windows 10 pro key

    office 2013 pro key sale

    cheap visual studio key buy

    ReplyDelete

Posting is provided "AS IS" with no warranties, and confers no rights.