Is it Possible to update List Items in SharePoint Online using Power Shell?
2 Answers
Yes its possible you need to SharePoint Online Management Shell for this purpose.
To use SharePoint Online PowerShell commands, you must be a SharePoint Online global administrator.
Download from - https://www.microsoft.com/en-us/download/details.aspx?id=35588
Connecting to SPO
$adminUPN="<the full email address of a SharePoint administrator account, example: [email protected]>"
$orgName="<name of your Office 365 organization, example: contosotoycompany>"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
-
2SharePoint Online Management Shell does not provide commands for updating list items, if I am not wrong. Can you share a link or commands that perform this functionality?– FarhanOct 26, 2017 at 14:23
-
Yes you are correct in that.. In either case first you need to connect using SPO tool and then you can use whatever API you are interested REST/CSOM Oct 26, 2017 at 15:56
-
The SharePoint Online cmdlets lack the ability to work with lists or list items. Though, we can still do this with CSOM from PowerShell. If you haven't done this before, you may find it easier to use the PNP PowerShell cmdlets, as the CSOM code has already been written for you.
This is a link to the getting started page. This is a link to the list of available commands, and this is a link to the page that shows how to update a list item.
Once you've gone through the setup process on the first page, the following is from the docs and hows the code to update a list item:
Set-PnPListItem -List "Demo List" -Identity 1 -Values @{"Title" = "Test Title"; "Category"="Test Category"}
edit: the documentation has moved. Searching for the name of the command should get you there, or here is the current link to the docs for the above command.