I am using below command using JavaScript to copy a document in the same site in SharePoint Online. The file is copied successfully, but the associated metadata term values selected from my term set is not getting copied.

I am getting:

_sourceFile = this.currentItem.get_file();

And then later I am doing:

_sourceFile.copyTo(_destinationlibUrl, 1);

File is copied but not term values.

Can it be done in another way?

1 Answer 1


I have found an example here that is copying files between libraries:

var context = SP.ClientContext.get_current();

It claims to copy the metadata as well.

  • Unfortunately it has the same behavior as with CopyTo, it only copies metadata with datatype Text, Datetime, Lookup, etc - not Managed Metadata term values from term set.
    – Xaphod
    Commented Feb 11, 2016 at 13:05
  • That's a pity. Out of curiosity, does it work when you use the interface to "Sent To" another location? Click on the file in the library and select the Documents tab. Locate "Send To", and select "Other Location" from the dropdown. I understand you're trying to programmatically achieve this, but if it works through the interface then I'm sure there must be a way to do it with code.
    – Ray Hogan
    Commented Feb 11, 2016 at 13:30
  • Yes, the "Send to > Copy" in the ribbon Files tab works for all metadata, including term values.
    – Xaphod
    Commented Feb 13, 2016 at 9:20

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.