locked
Using CSOM to log application exceptions RRS feed

  • Question

  • I'm trying to log exceptions via the Microsoft.SharePoint.Client.Utilities.Utility.LogCustomAppError. I receive an access denied exception when context.ExecuteQuery() is called in the code sample below. My app typically runs with Manage permissions on the Web and I also tried setting this to Full Control.  According to this article - http://msdn.microsoft.com/en-us/library/jj841104.aspx - the method I am using is intended to be used from within a SP hosted page, but I am trying to do this from a auto-hosted app's remote component. The article mentions another method LogCustomRemoteAppError that is intended to be used in this scenario, however I can't locate the method. According the method isn't a part of Microsoft.SharePoint.Client.Utilities.Utility class in the Microsoft.Sharepoint.Client.dll that is on my development environment. So, am I not supposed to use LogCustomAppError from a remote app and if not is there any supported method to log an application exception so that is show's up under the app's details page?

    using (var context = TokenHelper.GetClientContextWithContextToken(webUrl, appToken, urlAuthority)) {
                    Microsoft.SharePoint.Client.Utilities.Utility.LogCustomAppError(context, ex.Message);
                    context.ExecuteQuery();
                }

    Tuesday, April 9, 2013 7:08 PM

Answers

All replies

  • The method is right next to LogCustomAppError:

    Microsoft.SharePoint.Client.Utilities.Utility.LogCustomRemoteAppError(clientContext, productId, "Error");

    Do you have the latest version of the Office Developer Tools for Visual Studio 2012 installed? http://msdn.microsoft.com/en-us/office/apps/fp123627.aspx

    Regards,
    Philip

    Tuesday, April 9, 2013 9:04 PM
  • I'm pretty sure this was installed already - I'd need the tools installed in order to develop/deploy an auto-hosted app right? Shouldn't VS notify me when there are updates available?

    The assembly without the method I need has FileVersion=15.0.4128.1014. After updating the tools it has FileVersion=15.0.4481.1504 and the method is available. Thanks for the quick response.

    Tuesday, April 9, 2013 9:24 PM