Copy list attachment to library

Nov 13, 2015 at 5:17 PM
We have an intake list that reps use to start working with client. They can attach documents from the client during the intake process to the the list item. Once the project is understood we then disposition to our project tracker which is a library in a different site (same site collection, just a different site).

Using SP services to move the relevant bits of information over from intake to project. Working well. Except for the copying the attachments. It works for a document in a library, but not for list attachments. On a list no document is returned and the stream is empty.
var mOrgPath="https://onsite/managedpath/collection/site/Lists/listname/Attachments/id/filename.pdf"
 var myStream = "";
    jQuery().SPServices({
        operation: "GetItem",
        async: false,
        Url: mOrgPath,
        completefunc: function(xData, Status) {
            myStream = jQuery(xData.responseXML).find("Stream").text(); 
            }
    }); 
So I cobbled together I used this tutorial to extend jquery ajax request to include binary. It returns the data as an arraybuffer.
...
$.ajax({
      url: url0,
      type: "GET",
      dataType: "binary",
      processData: false,
      responseType:"arraybuffer",
      success:function(result){
         stream = base64ArrayBuffer(result)
      }
});
...
I then use this code to convert the arraybuffer from the ajax call to base64.

So now I have my base64 encoded stream to pass along to CopyIntoItems. But I get a warning that the command must be issue from the same web app as the destination.

I can't find any javascript document about CopyIntoItems, but the C#/VB documentation doesn't seem to say anything about such limits.

Any other ideas how to copy a list attachment to a document library in a different site?
Coordinator
Dec 13, 2015 at 7:10 PM
Rothrock:

As we discussed at SPFest Chicago (Great to meet you!), CopyIntoItems is sort of an odd beast. I think you should try UpdateListItems instead, and just create a new document. CopyIntoItems keeps a link back to the original document that seems to mess things up.

BTW, here's my post I told you about: http://sympmarc.com/2014/05/27/uploading-attachments-to-sharepoint-lists-using-spservices/

Let me know how it goes!

M.