Mit dem kostenlosen Office365-Konto wurde die Sharepoint-Online-Standardwebsite erstellt. Darauf habe ich eine Liste namens "Product" erstellt. Wenn ich versuche, alle Websites-Listen zu erhalten, wird die Produktliste nicht aufgeführt. Nur 2 Listen (1) Komponiert Aussehen & (2) Masterpage Galerie werden aufgelistet. Unten ist der Code meiner App.js.Napa SharePoint-App findet die erstellte Sharepoint-Liste nicht
'use strict';
var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
var web = context.get_web();
var lists = context.get_web().get_lists();
var listItems;
(function() {
// This code runs when the DOM is ready and creates a context object which is
// needed to use the SharePoint object model
$(document).ready(function() {
getAllLists();
});
// This function prepares, loads, and then executes a SharePoint query to get
// the current users information
function getAllLists() {
context.load(lists);
context.executeQueryAsync(onGetListsSuccess, onGetListsFail);
}
// This function is executed if the above call is successful
// It replaces the contents of the 'message' element with the user name
function onGetListsSuccess() {
$('#message').text('Hello ' + lists.get_count().toString());
//$('#message').text('Hello ' + web.get_title().toString());
var listEnumerator = lists.getEnumerator();
var selectListBox = document.getElementById("ListItemListBox");
if (selectListBox.hasChildNodes()) {
while (selectListBox.childNodes.length >= 1) {
selectListBox.removeChild(selectListBox.firstChild);
}
}
// Traverse the elements of the collection, and load the name of
// each list into the dropdown list box.
while (listEnumerator.moveNext()) {
var selectOption = document.createElement("option");
selectOption.value = listEnumerator.get_current().get_title();
selectOption.innerText = listEnumerator.get_current().get_title();
selectListBox.appendChild(selectOption);
}
}
// This function is executed if the above call fails
function onGetListsFail(sender, args) {
alert('Failed to get user name. Error:' + args.get_message());
}
})();