I am trying to get all versions from every item in a SharePoint list using only client-side through a web part.
Following the exemple at http://techfindings-prem.blogspot.ch/2014/06/how-to-get-all-versions-of-list-using.html and using the "deferred/promise" pattern, I'm stuck at the point of retrieving the fields using the two methods
var listItemInfo = web.getFileByServerRelativeUrl(filePath)
var listItemFields = listItemInfo.get_listItemAllFields();
The async query keeps failing while my filepath var seems correct (I can use it manually via a browser and correctly get a link to my list's items via their IDs)
Can anyone direct me to what might cause the issue ?
Here is a more extensive piece of the code (the parameters objlistEnumerator and objListItem are correctly extracted, you can get the full web part script at http://www.filedropper.com/historiquewebpart if it helps grabbing the context:
function itemsFieldsListSuccessCallback() {
alert("p2 itemsFieldsListSuccessCallback");
this.d.resolve(this.listItemFields);
}
function itemsFieldsListFailCallback() {
alert("p2 itemsFieldsListFailCallback");
this.d.reject("something bad happened in itemsFieldsList");
}
function getItemsFieldsList(objlistEnumerator, objListItem) {
var d = $.Deferred();
var objListItem = objlistEnumerator.get_current();
var id = objListItem.get_item('ID');
var filePath = 'my site collection/Lists/mylist/' + id + '_.000';
var listItemInfo = web.getFileByServerRelativeUrl(filePath)
alert(listItemInfo);
var listItemFields = listItemInfo.get_listItemAllFields();
alert(listItemFields);
clientContext.load(web);
clientContext.load(listItemInfo);
clientContext.load(listItemFields);
var o = { d: d, listItemInfo: listItemInfo, listItemFields: listItemFields };
clientContext.executeQueryAsync(Function.createDelegate(o, itemsFieldsListSuccessCallback), Function.createDelegate(o, itemsFieldsListFailCallback));
return d.promise();
}
Thanks,