Powershell Script to Copy the value of one column to another column in the same SharePoint List .
$site = new-object Microsoft.SharePoint.SPSite("http://localhst")
$web = Get-SPWeb -Identity http://localhst
$list =$web.Lists["List/Library Name"]
$items = $list.items
foreach ($item in $items)
{
$sourcevalue = $item["Column 1"]
$item["Column 2"] = $sourcevalue
write-host $sourcevalue
$item.update()
}
$list.update()
$site = new-object Microsoft.SharePoint.SPSite("http://localhst")
$web = Get-SPWeb -Identity http://localhst
$list =$web.Lists["List/Library Name"]
$items = $list.items
foreach ($item in $items)
{
$sourcevalue = $item["Column 1"]
$item["Column 2"] = $sourcevalue
write-host $sourcevalue
$item.update()
}
$list.update()
Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.
ReplyDeleteSalesforce Training in Chennai
Tnq very much
ReplyDeleteTnq very much
ReplyDeleteis the syntax for the powershell different for 2016 sharepoint on prem?
ReplyDeleteNo , same for SP 2016
DeleteHello, Can I run this on SharePoint online also right ?
ReplyDelete