Export (0) Print
Expand All

Delete

CRM 1.2
banner art

Deletes an instance of an entity.

Syntax

[Visual Basic]
Public Sub Delete(
  ByVal entityName As String,
  ByVal id As Guid
)
[C#]
public void Delete(
  string  entityName,
  Guid  id
);
[JScript]
public function Delete(
  entityName : String,
  id : Guid
);

Parameters

entityName

Specifies the name of the entity. For more information about naming conventions, see Entity Names.

businessEntityId

Specifies the ID of the entity instance you want to delete.

Return Value

No return value.

Remarks

Use this method to delete any instance of a Microsoft CRM entity that supports the Delete message.

To perform this action, the caller must have the Delete privilege to the entity type and access rights on the entity instance specified in the request class.

For a description of how actions on a parent instance affect child instances, see Cascading Rules.

Example

The following code example shows how to use the Delete method.

[C#]
// Set up the CRM Service.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// contactGuid is the GUID of the record being deleted.
Guid contactGuid = new Guid("4D507FFE-ED25-447B-80DE-00AE3EB18B84");

// Delete the contact.
// The EntityName indicates the EntityType of the object being deleted.
service.Delete(EntityName.contact.ToString(), contactGuid);
[Visual Basic .NET]
' Set up the CRM Service.
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' contactGuid is the GUID of the record being deleted.
Guid contactGuid = new Guid("4D507FFE-ED25-447B-80DE-00AE3EB18B84");

' Delete the contact.
' The EntityName indicates the EntityType of the object being deleted.
service.Delete(EntityName.contact.ToString(), contactGuid)

Related Topics

CrmService Class

Delete Message


© 2007 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft