0

Is it possible to copy the attachments of a list item to a Document library using 2013 designer workflows?

I am able to get the server relative URL of the attachments in the workflow, but I am not sure if there is a way to copy using the server relative URL

enter image description here

Is there a method like copyto that exists for copying files from library to a different library?

1 Answer 1

0

I converted the below request as a http request and called it from Designer workflow and it is copying files as expected

$.ajax({
url:"https://tenant.sharepoint.com/sites/sitename/_api/web/GetFileByServerRelativeUrl('/sites/sitename/Lists/ListName/Attachments/11/sample.jpg')/copyTo(strNewUrl='DestinationRelativeURL',bOverWrite=true)",
headers:{"accept":"application/json;odata=verbose","content-type":"application/json;odata=verbose","X-RequestDigest": jQuery("#__REQUESTDIGEST").val()},
method: "POST",
success:function(data){
console.log(data);
},
error:function(xhr){
console.log(xhr);
}
})

Before making this http request, we need to make one http request(_api/contextinfo) to get the RequestDigest

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.