DeleteLoggedExceptionDataByKey


Description

Deletes a single exception from the log based on the logId value supplied.

Parameters

Parameter

Type

Description

logId

guid

A key that uniquely identifies the logged exception.

context

Context

Specifies information about how the method will be called.


Interfaces

 

Examples

The following C# example deletes a logged exception. To use this example, the logid GUID in the example should be replaced with a valid logid from the exception log.

 Legacy endpoint

using System;
using System.Collections.Generic;
using System.Text;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Context context;
			Guid logId;

			// Create an instance of the service
			DynamicsGP wsDynamicsGP = new DynamicsGP();

			// Be sure the default credentials are being used
			wsDynamicsGP.UseDefaultCredentials = true;

			// Create a context object with which to call the service
			context = new Context();

			// Specify which company to use (sample company)
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set up the context object
			context.OrganizationKey = (OrganizationKey)companyKey;

			// Specify the logid to be deleted
			logId = new Guid("cc9170cf-17c0-4d2e-acb7-9457f1425aa7");

			// Delete the exception from the exception log
			wsDynamicsGP.DeleteLoggedExceptionDataByKey(logId, context);
	}
}
}

 Native endpoint

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Context context;
			Guid logId;

			// Create an instance of the service
			DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

			// Create a context object with which to call the service
			context = new Context();

			// Specify which company to use (sample company)
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set up the context object
			context.OrganizationKey = (OrganizationKey)companyKey;

			// Specify the logid to be deleted
			logId = new Guid("cc9170cf-17c0-4d2e-acb7-9457f1425aa7");

			// Delete the exception from the exception log
			wsDynamicsGP.DeleteLoggedExceptionDataByKey(logId, context);

			// Close the service
			if(wsDynamicsGP.State != CommunicationState.Faulted)
			{
				wsDynamicsGP.Close();
		}
	}
}
}


Documentation Feedback