0

I created a custom list and here I want to copy Created By column value to another field in same list

  • Source Field: Created By
  • Destination Field: Item Created User (this is Person/Group Field)

I have SP 2013 & Presently no workflows configured. I want to do by Simple PowerShell script.

0

I made this PowerShell script for you

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
$listName = "CustomList1"

#Get the SPWeb object
$web = Get-SPWeb http://spwapp/

#Get the SPList
$list = $web.Lists[$listName]

#Get all items in this list
$items = $list.items

#Go through all items
foreach($item in $items)
{
    $created = $item["Created By"]
    $item["DestinationPG"] = $created

    #Update the item
    $item.Update()

}

Copy and Paste this script, refer to your SP2013 site url and your List name, and execute it, it will update all the items at once.

FROM THIS enter image description here

TO THIS enter image description here

If this answers suit you, please upvote and accept it as an answer

6
  • Hi Aimen, when run this script no changes will happen destinatinfield has empty value, note here that Created By is person group field. Jun 29 at 10:42
  • Ah, I thought you wanted "Created" column, well, its gonna be the same, i will edit my answer Jun 29 at 11:01
  • @user3520155, here is it, answer edited ! Jun 29 at 11:09
  • yes i give Destination Field also Person Group type field but no value copied Jun 29 at 11:19
  • are you sure you are not missing something? it's working perfectly from my side ! Jun 29 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.