1

Trying to follow this post about halfway down to copy attachments from a list item.

$().SPServices({
    operation: "GetItem",
    async: false,
    Url:srcUrl,

    completefunc: function(xData, Status) {
        myStream = jQuery(xData.responseXML).find("Stream").text();
        console.log(myStream);
    } 
});

It doesn't produce any error, but xData.responseXML doesn't include any Stream node and the response text includes

<GetItemResult>0</GetItemResult>

Which leads me to believe it isn't finding the source file. My source URL is the url that is given when I check it in the item.

https://site/managedpath/collection/site/Lists/listName/Attachments/itemId/file%20name.pdf

When I paste the url into the browser it shows me the correct file, so I know there is a file there...

Any ideas on how to get the data stream for this document?

EDIT

It does work if I just try and grab a file out of a straight up library. So the problem seems to be with attachments. Where are attachments really stored?

  • Attachments are stored in the same location as the SharePoint item forms, in a folder named Attachments. You can browse this structure under "All Files" in Designer. You can retrieve attachment URLs dynamically with SPServices using "GetAttachmentCollection," but it doesn't provide a way to interact with the stream. – Erin L Nov 16 '15 at 18:58
  • As best I can tell GetAttachmentCollection only returns this list of the URLs. I am able to get the urls in several different ways, but need to interact with the stream. I need to copy the attachments themselves to another location. Why would they behave differently? – Rothrock Nov 16 '15 at 19:58
  • I would recommend asking on the SPServices discussion board. Marc is pretty responsive and always interested in new challenges. – Erin L Nov 17 '15 at 14:28
  • I posted there but haven't heard anything. And I'm hoping that someone might have a non-SP Services way of doing it. It seems like this should be a possible thing. – Rothrock Nov 17 '15 at 16:05
  • I saw you commented on a thread from 2010. I'd create a new thread. Have you seen the first answer on this question? sharepoint.stackexchange.com/questions/62087/… – Erin L Nov 17 '15 at 16:34

Your Answer

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

Browse other questions tagged or ask your own question.