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()}
Oct 24, 2022
What is you do a
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Variables
$SiteURL = "http://site"
$ListName = "Vendor Requests"
What does give you :
$List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
$items = $list.GetItems()
Write-Host $items
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Variables
$SiteURL = "http://site"
$ListName = "Vendor Requests"
What does give you :
$List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
$items = $list.GetItems()
Write-Host $items
dklbwf
Oct 26, 2022Copper Contributor
I was running the scripts under the wrong account. Once I figured that out script is working 100% correctly. Thanks a ton for your help!
- Oct 26, 2022Anytime mate, I was guessing that was the issue 🙂