Concatenate two fields and update the value into another field in SharePoint using PowerShell

Advertisement
In this article we can able to see , how to concatenate two fields and update the value in to another field in SharePoint using PowerShell.
How to update items in SharePoint using client object model
Get current login user in SharePoint using JQuery
We are have a site and list, inside the list we are having three columns we have to concatenate the  two field values and update the combined fields values to another field using PowerShell for existing items.

 Add-PSSnapin Microsoft.Sharepoint.Powershell
    $web =  Get-SPWeb -Identity "http://dotnetsharepoint.com/sites/sharepoint"
    $list =$web.Lists["ListName"]
    $items = $list.items
    foreach ($item in $items) 
    {
    $sourcevalue1 = $item["FieldName1"]
    $sourcevalue2=  $item["FieldName2"]
    $item["FieldName3"] = $sourcevalue1 +" - "+ $sourcevalue2
    $modifiedBy = $item["Editor"] 
    $modifieddate = $item["Modified"]
    $item["Editor"] = $modifiedBy
    $item["Modified"] = $modifieddate
    $item.Update()
    $list.Update()
    $web.Dispose()
}

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

Unknown

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a comment