3 ways for adding new column in SharePoint list
by Hojo Clement • May 12, 2010 • MOSS 2007, PowerShell, SharePoint 2010 • 1 Comment
In this post we will see 3 different methods for adding columns in SharePoint list or document library or discussion board.
using browser
Go to the list which you want to add column
On the page that displays the list, click list’s settings and create columns.
Type a name for the column, choose the column type and click OK.
using Object model
SPSite site = new SPSite(siteUrl); SPWeb web = site.OpenWeb(); site.AllowUnsafeUpdates = true; web.AllowUnsafeUpdates = true; SPList list = web.Lists["mylist"]; SPFieldText fldName = (SPFieldText)list.Fields.CreateNewField(SPFieldType.Text.ToString(), "mycolumn"); fldName.Required = true; fldName.MaxLength = 50; list.Fields.Add(fldName); list.Update(); site.AllowUnsafeUpdates = false; web.AllowUnsafeUpdates = false;
using PowerShell
[system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
$site= New-Object Microsoft.SharePoint.SPSite ("http://mysite")
$web=$site.OpenWeb()
$list=$web.Lists["mylist"]
$list.Fields.Add("mycolumn", "Text", 0)

Wanted to know how to create a multiline text field in a list or a library..needed help urgently..