I have created a SharePoint Addin following this step by step Microsoft guide and it works fine.
Now I would like to add some javascript CSOM to my "internal" list and I wrote the following code:
function createListItem() {
var siteUrl = 'https://mysharepointaddress.sharepoint.com/sites/app';
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('New Employees in Seattle');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', 'My New Item!');
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
The list name cannot be found.
I would try with .getById(guid)
but i don't know how to find the guid of this list.
Tested on a normal list, created via Site Content - Add an app, and the code works fine.
Any advice is much appreciated, thanks in advance!