I've a custom action on the CommandUI.Ribbon. It triggers a SharePoint add-in and sends the ListID allong as parameter.
In the Add-in page, I try to upload a document (from a rest service).
When I try to get the document library by it's ID, it steps out of the debugger and I have no clue why.
var ctx = SP.ClientContext.get_current();
var fileCreateInfo = new SP.FileCreationInformation();
fileCreateInfo.set_url(documentName);
fileCreateInfo.set_overwrite(true);
fileCreateInfo.set_content(content);
var parentList = ctx.get_web().get_lists().getById(listId); //steps out here.
Is it possible that the getById method doesn't exist?
Hope to hear from you guys and girls...
if You plan to use JSOM to query the list from SharePoint You should also do the executeQuery. The flow of using JSOM is:
Please refer to this msdn article for more information
I suppose for Your needs this kind of solution might work
If You have the proper context were the list is present and the needed permissions the output of running retrieveAllListProperties() should be the title of the queried list.
I hope this will be of any help :)