Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to download the list item attachment with content using rest api?

$
0
0

Hi,

We are moving the list item attachment from one list to another list using SharePoint hosted app however we could not able to download the attachment with content using rest api. We are using the below approach to get the attachment.

        var filterQuery = appweburl + "/_api/SP.AppContextSite(@target)/web/lists/getByTitle('crosslist')/items?$select=AttachmentFiles,Title&$expand=AttachmentFiles&@target='" + hostweburl + "'";

  var jsonObject = JSON.parse(data.body);
                           var results = jsonObject.d.results;

                           $.each(results, function (index, items) {
                        
                               FileName = items["AttachmentFiles"].results[0].FileName;
                               serverrelativeurl = items["AttachmentFiles"].results[0].ServerRelativeUrl;
                           });

Please let me know the solution 



Viewing all articles
Browse latest Browse all 7589

Trending Articles