Utility::LogCustomRemoteAppError method
Reports custom errors from remote components of cloud-hosted SharePoint Add-ins.
Namespace: Microsoft.SharePoint.Client.Utilities
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Parameters
- context
- Type: Microsoft.SharePoint.Client.ClientRuntimeContext
The client context.
- productId
- Type: System.Guid
The product ID of the SharePoint Add-in.
- error
- Type: System.String
The custom error message.
Return value
Type: Microsoft.SharePoint.Client.ClientResult<LogAppErrorResult>A value that specifies whether the log attempt succeeded.
The productId must be the same as the ProductID attribute of the App element (SharePoint Add-in Manifest) in the app manifest. Since a web application that is calling LogCustomRemoteAppError(ClientRuntimeContext, Guid, String) does not have an easy secure way to get this information at runtime, you should store this value in the web application. Consider using a Global.asax file and a Global.asax.cs (or Global.asax.vb) file for this purpose. Define a publicstatic field of type Guid in the Global class of the code behind file. Assign it the product ID from the app manifest (including the "{}" symbols and hyphens) as in the following example:
Public static Guid productID = new Guid("{2ED827F8-5736-4792-B287-A27F64F1D09D}");
Then pass Global.productID for the productId parameter.