REST File.CopyTo


  • Hi

    I'm using File.CopyTo using a REST call. I have two issues with this:

    (1) My document ID is copied from source to destination. This means I have two documents with the same document id after using this method.

    (2) My managed metadata columns are not copied from source to destination.

    Am I missing something ? Or are this bugs with the REST File.copyTo method ?

    Best regards,

    Marc Nemegeer

    Monday, March 6, 2017 2:20 PM

All replies

  • If you are using SharePoint Online, try to use SP.MoveCopyUtil.copyFile to copy the file's metadata as well.

    More info

    The example is JSOM

    var context = SP.ClientContext.get_current();

    The method can be called from REST as well with parameters srcUrl and destUrl.

    Monday, March 6, 2017 5:03 PM
  • Hi Marc Nemegeer,

    If the reply is helpful to you, you could mark the reply as answer. Thanks for your understanding.

    Best regards,

    Sara Fan

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Wednesday, March 8, 2017 9:17 AM
  • Hi Reshmee011, Hi Sarah

    Yes, the link provided was worth a second try. But I have exactly the same problem. The SP.MoveCopyUtil uses the same File.CopyTo to do its job, I think.

    No I would not call this is a solution ;-)

    For me it is a bug in Office 365 that the File.CopyTo does not:

    (1) Change the document ID to a new value. A Copy results in a new document ID, a move keeps the document ID.

    (2) Does not copy the managed metadata values for the different columns.

    I have the same behavior when doing this from the user interface, using the copy in the new document library layout. So, easy to reproduce ;-)

    Best regards,


    Wednesday, March 8, 2017 4:04 PM