Recently I have a implemented a functionality in a SharePoint project, Get the attachment from a SharePoint list with a icon according to the type of attachement. After long practice we are able to resolve the same. Now I am sharing you the solution with you, I think it would help to you. Javascript Methods var SiteURL = ''; function getAttachments(ID,ListName) { var PageURL = window.location.href; var LastIndexOfPage = PageURL.substring(PageURL.lastIndexOf("/")); PageURL += "/"; SplitLastIndexOfPage = LastIndexOfPage.split("/"); var FirstIndexOfPage = PageURL.split("/"+SplitLastIndexOfPage[1]+"/"); //var lists = new SPAPI_Lists('http://sharepointdev:123/sites/myteamsite/phases/'); SiteURL = FirstIndexOfPage[0]; var lists = new SPAPI_Lists(SiteURL); var items = lists.getAttachmentCollection(ListName,ID); if (items.status == 200) { var rows = items.responseXML.getElementsByTagName('Attachment'); v...
SharePoint Excellence is a community for Microsoft 365 professionals.