i want to fetch the list items from office 365 developer site
by using client side object modal
pls help
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manesh GolekarRank #5,709 · 289 reputationPosted Aug 17, 2014, 11:17 PM EDT
http://msdn.microsoft.com/en-us/library/office/jj163201(v=office.15).aspx
It has sample example for retrieving list items using javascript client object model .
Best
M
satish babuRank #2,232 · 629 reputationPosted Aug 27, 2014, 11:35 PM EDT
function getitems() {
var selectedListTitle = web.get_lists().getByTitle(listname);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("
"
"
"
listItemCollection = selectedListTitle.getItems(camlQuery);
context.load(listItemCollection, "Include(Title, ID)");
context.executeQueryAsync(onGetItemsSuccess, onGetItemsFail);
}
function onGetItemsSuccess(sender, args) {
// The list items were retrieved.
// Show all child nodes.
var listItemEnumerator = listItemCollection.getEnumerator();
var selectItemBox = document.getElementById("selectitembox");
if (selectItemBox.hasChildNodes()) {
while (selectItemBox.childNodes.length >= 1) {
selectItemBox.removeChild(selectItemBox.firstChild);
}
}
while (listItemEnumerator.moveNext()) {
var selectOption = document.createElement("option");
selectOption.value = listItemEnumerator.get_current().get_item('ID');
selectOption.innerHTML = listItemEnumerator.get_current().get_item('Title');
selectItemBox.appendChild(selectOption);
}
}
function onGetItemsFail(sender, args) {
// The list items couldn't be retrieved - display an error message.
alert('Failed to get items. Error: ' + args.get_message());
}