I have a Visual Studio 2013 solution and I have been successfully able to get list items from the host web using the following JavaScript code:
var context = SP.ClientContext.get_current();
var factory;
var appContextSite;
var mylist;
context = new SP.ClientContext(appweburl);
factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
context.set_webRequestExecutorFactory(factory);
appContextSite = new SP.AppContextSite(context, hostweburl);
this.web = appContextSite.get_web();
mylist = this.web.get_lists().getByTitle('My List');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<Query><OrderBy><FieldRef Name=\'ID\'/></OrderBy></Query>');
var collListItem = mylist.getItems(camlQuery);
context.load(mylist);
context.load(collListItem);
context.executeQueryAsync(
Function.createDelegate(this, success),
Function.createDelegate(this, error)
);
However I have now created an External Content Type inside of the app and need to get information from the list that has been created:
I have tried modifying my code and having a look through MSDN but so far there appears to be very limited information on this.
I would appreciated any help and guidance that can be provided for this.
not initialized
error