• Get Attachment URL from list item (en)

    Get Attachment URL from list item (en)

    afraIT Shorty-Time! Just want to share a little script on how to get the attachment url or the attachment filename of an list item in SharePoint 2013. There is often the request, that someone wants to get the complete URL of an uploaded document, picture or whatever. Here it is, a short javascript with a little REST in it: <script type=”text/javascript”> $(document).ready(function() { // Rest URL var requestUri = “/_api/lists/getbytitle(‘Marketplace’)/items?$select=Title,ID,Attachments,AttachmentFiles&$expand=AttachmentFiles”; $.ajax({ url: requestUri, type: “GET”, headers: { “ACCEPT”: “application/json;odata=verbose” }, success: function (data) { $.each(data.d.results, function (i, item){ var title = item.Title; var id = item.ID; var attachmentUrl = item.AttachmentFiles.results[0];

    Read More