Skip to main content

Posts

Showing posts from February, 2011

Get attachment with attachment icon

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...

Resolve 'SPAPI_Lists' is undefined

Problem: 'SPAPI_Lists' is undefined Cause: You forget to attach reference of SPAPI_Core.js and SPAPI_Lists.js. Resolution: Services JS API Includes Required Lists.asmx SPAPI_Core.js SPAPI_Lists.js Copy the SPAPI_Core.js and SPAPI_Lists.js to your application inside folder and include reference of SPAPI_Core.js and SPAPI_Lists.js to your page inside head tag. e.g