Below is my code. I am able to get the file name and modified date.. I need to get the files' paths, the modified by field, and files metadata (some of which are lookup fields).
var ListName = 'My Documents';var ctx = SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle(ListName);
var caml = SP.CamlQuery.createAllItemsQuery();
caml.set_viewXml("<View><Query></Query><RowLimit>500</RowLimit></View>");
allitems = list.getItems(caml);
ctx.load(allitems);
ctx.executeQueryAsync(Function.createDelegate(this, this.onDocumentsSucceededCallback), Function.createDelegate(this, this.onDocumentsFailedCallback));
function onDocumentsSucceededCallback(sender, args) {
var ListEnumerator = this.allitems.getEnumerator();
while (ListEnumerator.moveNext()) {alert('items are being picked up');
var listItem = ListEnumerator.get_current();
// alert('file name is: '); alert(listItem.get_item().get_file());
// var file = listItem.get_file();
alert(listItem.get_item('FileLeafRef'));
// alert(listItem.get_item('Modified'));
// alert(listItem.get_item('Modified By'));
}
}
faye fouladi