I have written some code which adds a list client side in powershell :

   $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url)

   $ctx.Credentials = $credentials

   $web = $ctx.Web 

   Invoke-LoadMethod -ClientObject $web


   $ListInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation
   $ListInfo.Title = $ListTitle
   $ListInfo.TemplateType = "100"
   $myList = $web.Lists.Add($ListInfo)
   $myList.Description = $ListTitle

What I want to do is create some fields to add to this. Tried this but it didn't work :

$myFieldPrivacyStatementurl = $myList.Fields.Add("PrivacyStatementUrls","URL",1)
$myList.Fields[$myFieldPrivacyStatementurl].Title = "Privacy Statement Urls"
$myFieldIsActive = $myList.Fields.Add("IsActive","Boolean",0)
$myList.Fields[$myFieldIsActive].Title = "Is Active"
$myFieldSortOrder = $myList.Fields.Add("SortOrder","Number",1)
$myList.Fields[$myFieldSortOrder].Title = "Sort Order"
  • Are you getting any error?
    – Aanchal
    Jun 25, 2014 at 9:03
  • YES, this works server side but I want client side
    – bimbob
    Jun 25, 2014 at 9:06
  • Get errors when do that piece of code client side
    – bimbob
    Jun 25, 2014 at 9:06

1 Answer 1


The error occurs since Add method does not accept 3 parameters.

How to add column into List via CSOM in PowerShell

The following methods are used for adding fields into List:

FieldCollection.Add method

Example: add an existing site column into List

#Retrieve List
$List = $Context.Web.Lists.GetByTitle($ListTitle)

#Retrieve site columns (fields)
$SiteColumns = $Context.Web.AvailableFields

#Find an existing site column
$City =  $Context.Web.AvailableFields | Where {$_.Title -eq "City"}

#Add field to the List

FieldCollection.AddFieldAsXml method

Example: add a new Field into List

#Retrieve List
$List = $Context.Web.Lists.GetByTitle($ListTitle)

#Add new field to the list
$List.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>",$true,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.