Thursday, July 23, 2015

SharePoint Online: Update List Items using PowerShell

PowerShell CSOM Script to update List Items in SharePoint Online:
Here is the example for SharePoint online PowerShell to update list item.

#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 = ""

$Password ="Password goes here"
#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

    #Filter and Get the List Items using CAML
    $List = $Context.web.Lists.GetByTitle($ListName)

    #Get List Item by ID
    $ListItem = $List.GetItemById(1)  

    #Update List Item title
    $ListItem["Title"] = "Project Darwin"  

    write-host "Item Updated!"  -foregroundcolor Green  
    write-host "$($_.Exception.Message)" -foregroundcolor red  
This updates the Item with ID: 1 for the given list.
sharepoint online powershell update list item
Tags: sharepoint online powershell edit list item, sharepoint online powershell update list item, powershell update list item sharepoint online

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:


  1. can you show an example where you update the SP list if the ID in the csv is equal to the ID on the SP list?


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...