In this example we are able to show,how to add fields to list in sharepoint using powershell script.
Here list is already available,we are accessing the list and adding the Text Type column to the existing list,first it will check the condition weather that particular field is available in the list or not,if not available than only we can able to create the Field.
Add-PSSnapin Microsoft.SharePoint.PowerShell
#Get the Site URL
$weburl = Get-SPWeb "http://dotnetsharepoint.com/sites/SharePoint/SharePoint2013"
#Get the List Name
$list = $weburl.lists["YourListName"]
#check condition field is available or not
if($list.Fields.ContainsField("YourColumnName") -eq $true) {
Write-Host "FieldName already avilable in the List"
}
else
{
#Add New Text type field to the list
$SPFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$list.Fields.Add("YourColumnName",$SPFieldType,$false)
$list.update()
}
SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM