How to update SharePoint List items in Office 365 using Powershell?

Hello SharePointers,

Below are the powershell script to update SharePoint list items in Office 365/Sharepoint Online using Powershell.

Load SharePoint CSOM Assemblies
Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”

#Variables for Processing
$SiteUrl = “Your site URL ”

$Password =”Password”

#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))

#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $credentials


$List = $Context.web.Lists.GetByTitle($ListName)

$ListItem = $List.GetItemById(1)

#Update List Item title
$ListItem[“Title”] = “Joe”

write-host “Item Updated!” -foregroundcolor Green
write-host “$($_.Exception.Message)” -foregroundcolor red

Happy SharePointing 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *