cancel
Showing results for 
Search instead for 
Did you mean: 

How to copy a file from one document to another?

kodermax
Star Contributor
Star Contributor

How to copy a file from one document to another?

1 ACCEPTED ANSWER

Guillaume_Renar
Star Contributor
Star Contributor

You can use the CopyOperation.java automation operation.

To execute an operation with the JS client, please refer to https://doc.nuxeo.com/nxdoc/javascript-client/ . Something along those lines:

         nuxeo.operation('Document.Copy')
          .input(src.uid)
          .params({'target': target.uid})
          .execute()
          .then(function(newlyCreatedDoc) {
            // work with the copied doc
          })
          .catch(function(error) {
            // something went wrong
            throw error;
          });

View answer in original post

3 REPLIES 3

Guillaume_Renar
Star Contributor
Star Contributor

The context of the question is too vague. Are you asking programmatically, using Rest API, automation, in JSF UI, Web UI?

kodermax
Star Contributor
Star Contributor

I use nuxeo-js-client for browser.

Guillaume_Renar
Star Contributor
Star Contributor

You can use the CopyOperation.java automation operation.

To execute an operation with the JS client, please refer to https://doc.nuxeo.com/nxdoc/javascript-client/ . Something along those lines:

         nuxeo.operation('Document.Copy')
          .input(src.uid)
          .params({'target': target.uid})
          .execute()
          .then(function(newlyCreatedDoc) {
            // work with the copied doc
          })
          .catch(function(error) {
            // something went wrong
            throw error;
          });