Forum Discussion
dklbwf
Oct 21, 2022Copper Contributor
Powershell script to update multiple items from ID field
Hello, I have a request for 2 SharePoint 2013 OnPrem list where they are needing 1,000 records in both lists to simply have the status updated to completed and comment added for specific records. O...
- Oct 23, 2022dklbwf try this 🙂Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue#Variables$ListName = "vr"$List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)$ItemIDs = 17148, 17147foreach($ItemID in $ItemIDs){$SPListItem = $List.GetItemByUniqueId($ItemID)$ListItem["Status"]="Completed"$ListItem["Request Comment"]="Completed 10-21-2022"$SPListItem.Update()}
dklbwf
Oct 23, 2022Copper Contributor
Thanks for response. It's not all items, I am needing to update only specific items and wanting to update them by using the ID assigned to each item in the list.
Oct 23, 2022
dklbwf try this 🙂
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Variables
$ListName = "vr"
$List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
$ItemIDs = 17148, 17147
foreach($ItemID in $ItemIDs)
{
$SPListItem = $List.GetItemByUniqueId($ItemID)
$ListItem["Status"]="Completed"
$ListItem["Request Comment"]="Completed 10-21-2022"
$SPListItem.Update()
}