I have a SharePoint hosted app that creates a list instance. I'm trying the simple task of creating a list item but it doesn't work. No errors are displayed and I am not able to get into the success or failed methods when debugging.
function createListItem(appwebUrl) {
var clientContext = new SP.ClientContext(appwebUrl);
var oList = clientContext.get_web().get_lists().getByTitle('CustomList');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', 'My New Item!');
oListItem.set_item('CustomField Text', 'Hello World!');
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}
function onQuerySucceeded() {
alert('Item created: ' + oListItem.get_id());
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
I've also tried this with REST and the same thing occurs. No error, it just doesn't work. What's up with my App?