GetItem functionality to get the stream of attachments not working

Aug 29 at 3:06 PM
Edited Aug 29 at 3:09 PM

I am trying to copy list items including attachments from one list to another. In order to copy the attachments, I thought I would use the GetItem functionality to get the attachment item stream and then use AddAttachment to add it to the other list. However, GetItem functionality returns no stream for attachment urls. The response received back is <GetItemResponse xmlns=""><GetItemResult>0</GetItemResult></GetItemResponse>. And my request looks something like this:

operation: "GetItem",
Url: location.protocol+"//""/"+pathtosite+"/Lists/"+listname+"/Attachments/"+itemid+"/test.docx"

Interestingly, I do get the Stream back if I supply a url pointing to a document in document library.

We are on SharePoint 2007. Any help appreciated. Thank you.
Aug 29 at 5:29 PM
Call GetAttachmentCollection to get the URLs, and then go from there...

Aug 29 at 6:48 PM

Sorry, I failed to mention it. GetAttachmentCollection is what I have been using to get the attachment urls. But when it was not working, I tried using a manually supplied attachment URL to see if I could get to the stream using GetItem. And that's when I posted this discussion. So, GetAttachmentCollection also returns the same exact attachment url that I manually supplied in the original post but GetItem will not fetch the item stream for attachments.

Thank you.
Sep 1 at 9:36 PM
Once you have the URL to the attachment, you can open the file at that location and read it. You don;t get a stream from any of these services: you need to open the file yourself.