Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Script to update a column with two fields (Powershell)

$
0
0

Hi,

I am trying to update a column in all items in a document library via Powershell. The column is Name and it will updated with two combined existing fields Name and ID. The result is Name_ID. This is what I have so far. I think I am close but missing something

$spWeb = Get-SPWeb -Identity http://www.google.com/
$spsite = Get-SPSite -Identity http://www.google.com/test
$spListItem [“FileName”] = $spListItem [“Name”]+$spListItem [“ID”]

$spList = $spWeb.Lists[“Test Library”]

foreach($item in $list.Items)
{
if($item["Name"] = "Item")
{
$item["Name"] = "[Name]_[ID]"
$item.update()
}
}




$spListItem.Update()


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>