2

On a SharePoint site I have a workflow that allows users to duplicate an item from a list. I found out when a user duplicate an item the author(field created by) of this item remains the first person who created this item. How I can modify this workflow so that the author of the item becomes the person who duplicated the item?

1 Answer 1

2

I am not sure if you can change it via workflow as this is readOnly field, but i know you can set it via using powershell. here is the code for it

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0 
#specify new user - login name 
$newuser = "Support\paulmather" 
#specify the web URL 
$site = get-SPWeb http://vm353/pwa/ProjectBICenter 
#specify the list name 
$list = $site.Lists["Test"] 
$listitems = $list.Items 
$user = get-SPuser -Web $site -Identity $newuser 
#loop through each list item and update 
foreach ($listitem in $listitems) 
    { 

        $listitem["Author"] = $user 
        $listitem["Editor"] = $user        
        $listitem.Update() 
        write-host $listitem["Name"] "has been updated. The author and editor has been set to $user" 

    } 
$site.Update() 
$site.Dispose()

Update SharePoint list item Author and Editor

1
  • Don't you have to use .SystemUpdate() on the list item to override those columns? Or is that just for the Modified Date? Nov 17, 2016 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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