Delete Method

The Delete method deletes an existing instance of an entity. This method doesn’t return any value and accepts two input parameters. The first parameter is a string containing the entity type, and the second parameter is the GUID of the instance of the entity you will delete.

The example in Listing 24.7 shows how to delete a new Account programmatically in Visual Studio 2012 with C#.

LISTING 24.7 Delete New Account with C#

private static string DeleteAccount(string organizationName,        Guid accountToDelete)         {             using (XrmSdk.OrganizationServiceClient myCrm =             new XrmSdk.OrganizationServiceClient())             {                 try                 {                     myCrm.Endpoint.Address ...

Get Microsoft Dynamics CRM 2013 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.