none
how to duplicate an item in sharepoint 2016 without overriding Created_By value RRS feed

  • Question

  • Hi, 

    One of my requirements is to copy an item from the list to move to another list. I was able to do it. But, I still want to maintain Created_By and Modified_By column as original value. Now, it is overriding with new value, person who move the list. Able to advise how to do this?

    Many thanks.

    joe

    Tuesday, April 9, 2019 3:11 AM

All replies

  • Hi

    I am afraid you need to implement it by code.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Tuesday, April 9, 2019 4:38 AM
  • Hi,

    You can create the workflow and select all field which you wanted to copy(means mapping need to do ). It won't allow you to select default SharePoint fields like created by, created, modified and modified by. If the user will have the same permission in both the list it will help.


    Cheers, Kuldeep Verma, *Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful."


    Tuesday, April 9, 2019 4:46 AM
  • Many thanks for your help.
    Tuesday, April 9, 2019 8:54 AM
  • Is there any site that I can use as reference? Many thanks.
    Tuesday, April 9, 2019 8:55 AM
  • Is it solving your purpose? If Yes, can you mark it Answer?

    Cheers, Kuldeep Verma, *Please remember to click "Mark As Answer" if a post solves your problem or "Vote As Helpful" if it was useful."


    Tuesday, April 9, 2019 9:14 AM
  • Hi joe,

    To keep Created_By and Modified_By column when copy an item to another list, I recommend you using PowerShell command to read the values of these fields in source and update them in destination:

    $Author = $sWeb.EnsureUser($RootItem.Author)
    
    $Editor = $sWeb.EnsureUser($RootItem.Editor)
    
    $destinationItem["Author"] = $Author
    
    $destinationItem["Editor"] = $Editor
    
    $destinationItem.SytemUpdate()

    More information:

    https://social.msdn.microsoft.com/Forums/office/en-US/8978aa3a-7cc8-4968-b89c-e2c882ad6f46/how-do-i-copy-over-quotcreated-byquot-amp-quotmodified-byquot-field-values-to-a-new?forum=sharepointdevelopment

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, April 10, 2019 2:24 AM
  • Hi Grace, 

    Thanks for info. But, my requirement is that when copying an item from the list to another, it should automatically update. Does your script have to run at powershell after copying or is there a way I can add it into Flow so that every time an item is copied, no manual script execution is involved. 

    Thanks,

    joe

    Monday, April 15, 2019 8:51 AM
  • Hi joe,

    The script need to run after copying the item.

    To run this script automatically, I recommend you create a event receiver with code that trigger a PowerShell Script when the item is added in the list in SharePoint.

    Reference:

    How to: Create an event receiver

    Run PowerShell Script from a Event Receiver

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, April 22, 2019 8:37 AM
  • Hi joe,

    Is there any update?

    If the post helps you, you can mark it as answer.

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, April 25, 2019 9:15 AM