0

Is it possible to copy an attachment on a list item to a document library within the same site using SPD workflows and the REST api?

I have tried using the copyto function, but I cannot get it to work.

I have the relative url of the attachment itself (using another REST call).

All other solutions is off the table, I cannot use any 3rd party solutions or scripting or anything.

BR Morten

  • possibly useful? sympmarc.com/2016/04/20/… – Eric Alexander Apr 21 '16 at 13:44
  • @EricAlexander Unfortunately not :-( The target of that post is to upload the attachment to the list item itself, not to upload it to a document library (Which is seperate to the list) - at least that's how I read the article. – Morten K Apr 25 '16 at 5:16
1

Sometimes getting away and coming back wth fresh eyes is a good thing. I have made it work using the copyto function.

/_api/web/getfilebyserverrelativeurl('folder/filename.txt')/copyto(strnewurl='sites/sitesname/libraryname/filename.txt',boverwrite=false)

I still have an issue to fix though, the file get corrupted and cannot open (Happens on xlsx and docx files - but not txt files) - but that should be possible to fix I'm pretty sure!

| improve this answer | |
  • Oh scratch that last comment as well. It seem everything now works perfectly. – Morten K Apr 25 '16 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.