I made a custom action that calls GetSelectedListItemAsString(). it should load the files 1 by 1 but somehow it does not load the files can somebody help me with it underneat a code snippet of the code which errors.
var clientContext = ''; var web = ''; var list = ''; var items = ''; var item = ''; function GetSelectedListItemsAsString() { SP.SOD.executeOrDelayUntilScriptLoaded(initialize, 'SP.js'); } function initialize() { this.clientContext = new SP.ClientContext.get_current(); this.web = this.clientContext.get_web(); this.clientContext.load(web); this.clientContext.executeQueryAsync(Function.createDelegate(this, getRelativeUrl), Function.createDelegate(this, getFailed)); try { this.list = this.web.get_lists().getByTitle('Deliverables'); this.items = SP.ListOperation.Selection.getSelectedItems(this.clientContext); var count = CountDictionary(this.items); for (var i in this.items) { // alert(i); if (this.items[i].fsObjType == 0) { this.item = this.list.getItemById(this.items[i].id); this.clientContext.load(this.item, 'FileLeafRef'); } } clientContext.executeQueryAsync(onItemsLoaded, onError); } catch (e) { alert('Exception: ' + e); } } function getRelativeUrl(ctx) { // alert('web.get_serverRelativeUrl() ' + web.get_serverRelativeUrl()); } function getFailed() { alert('Failed to retrieve the server relative URL.'); } function onItemsLoaded() { alert('onItemsLoaded'); alert(this.item.get_item('Status')); for (var i in this.items) { alert(i); } } function onError(e) { alert('Error: ' + e); }
thanks in advance.
Paul
Check my website http://kbworks.nl or follow me on@KbWorks be sure to Check my SharePoint-Specialist.nu for dutch information workers check Wat Is microsoft SharePoint.nl for dutch readers who want to know what microsoft office365 is.