Share via


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)

Syntax

'Declaration
Public Shared Function LogCustomRemoteAppError ( _
    context As ClientRuntimeContext, _
    productId As Guid, _
    error As String _
) As ClientResult(Of LogAppErrorResult)
'Usage
Dim context As ClientRuntimeContext
Dim productId As Guid
Dim error As String
Dim returnValue As ClientResult(Of LogAppErrorResult)

returnValue = Utility.LogCustomRemoteAppError(context, _
    productId, error)
public static ClientResult<LogAppErrorResult> LogCustomRemoteAppError(
    ClientRuntimeContext context,
    Guid productId,
    string error
)

Parameters

  • productId
    Type: System.Guid

    The product ID of the SharePoint Add-in.

Return value

Type: Microsoft.SharePoint.Client.ClientResult<LogAppErrorResult>
A value that specifies whether the log attempt succeeded.

Remarks

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.

See also

Reference

Utility class

Utility members

Microsoft.SharePoint.Client.Utilities namespace