How to Log Errors in SharePoint Hosted Apps?
It is most common thing to log error message if some exception occurs within the code, so that user can find out what causing the error. It is straight forward if you using Server side object model. Since Hosted apps only use JavaScript object model and its bit new to many of us, not sure which namespace/class to use.
We use SP.Utilities.Utility.logCustomAppError method to log the app errors. Following is the sample code
function onFail(sender, args) {
logAppError(args.get_message() + '\n' + args.get_stackTrace());
}
function logAppError(message) {
SP.Utilities.Utility.logCustomAppError(context, message);
this.context.executeQueryAsync();
}
SharePoint 2013 App Model – How to View list With in APP
If you working on SharePoint 2013 APP, at some point you defiantly want to see list items contained within the app. Unfortunately there is no navigation to traverse to list.
To view specific list in “APP Web”, you directly type the url which specified in the following format in browser
http://<APP WEB URL>/<APP NAME>/Lists/<List Name>/AllItems.aspx
Ex: http://app-0eb6021fad963e.apps.com/sites/SP2K13/WhiteCaseEDARAPP/Lists/Calendar/AllItems.aspx
If in case you want to see the List settings,
- Click “Modify View” under List tab
- Click on “Settings” link as shown below