OrganizationService.Delete Method (String, Guid)

 

Applies To: Dynamics CRM 2015

Deletes a record. (Developer Extensions)

Namespace:   Microsoft.Xrm.Client.Services
Assembly:  Microsoft.Xrm.Client (in Microsoft.Xrm.Client.dll)

Syntax

public virtual void Delete(
    string entityName,
    Guid id
)
public:
virtual void Delete(
    String^ entityName,
    Guid id
)
abstract Delete : 
        entityName:string *
        id:Guid -> unit
override Delete : 
        entityName:string *
        id:Guid -> unit
Public Overridable Sub Delete (
    entityName As String,
    id As Guid
)

Parameters

  • entityName
    Type: System.String

    Type: String. The logical name of the entity that is specified in the entityId parameter.

  • id
    Type: System.Guid

    Type: Guid. The ID of the record that you want to delete.

Implements

IOrganizationService.Delete(String, Guid)

Remarks

This is a wrapper for the IOrganizationService. Delete Method.

Message Availability

 This message works regardless whether the caller is connected to the server or offline.

Not all entity types support this message offline. See Supported Entities later in this topic.

Privileges and Access Rights

To perform this action, the caller must have privileges on the entity that is specified in the entityName parameter and access rights on the record that is specified in the id parameter. For a list of the required privileges, see Delete message privileges. When a record is deleted, all child records are also deleted. The entire deletion fails if the caller does not have the delete privilege or access rights for any of these records.

Notes for Callers

This method may cascade to related records according to the cascade configuration for each entity relationship. For a description of how actions on a parent record affect related records, see Cascading behavior.

Typically, you should only delete records that you entered by mistake. For some record types, you can deactivate or close the record instead.

You can use this method to delete any record of an entity that supports the Delete message, including records from custom entities.

For more information about the exceptions that can be thrown when you call this method, see Handle exceptions in your code.

Supported Entities

The following table shows the default entities that support this message. For the listed entities of this message, the Availability column shows Server if the caller must be connected to the server and shows Both if the caller can be either connected to, or disconnected from, the server.

Entity

Availability

account

Both

activitymimeattachment

Both

annotation

Both

annualfiscalcalendar

Both

appointment

Both

asyncoperation

Server

attributemap

Server

bulkdeleteoperation

Server

bulkoperation

Server

businessunit

Server

businessunitnewsarticle

Both

calendar

Both

campaign

Both

campaignactivity

Both

campaignresponse

Both

columnmapping

Both

competitor

Both

connection

Both

connectionrole

Both

connectionroleobjecttypecode

Both

constraintbasedgroup

Both

contact

Both

contract

Server

contractdetail

Server

contracttemplate

Server

customeraddress

Both

customeropportunityrole

Both

customerrelationship

Both

discount

Server

discounttype

Server

duplicaterule

Server

duplicaterulecondition

Server

email

Both

equipment

Server

fax

Both

fieldpermission

Server

fieldsecurityprofile

Server

fixedmonthlyfiscalcalendar

Both

goal

Server

goalrollupquery

Server

import

Both

importentitymapping

Both

importfile

Both

importjob

Both

importmap

Both

incident

Both

incidentresolution

Both

invoice

Both

invoicedetail

Both

isvconfig

Server

kbarticle

Both

kbarticlecomment

Both

kbarticletemplate

Both

lead

Both

letter

Both

list

Server

lookupmapping

Both

mailmergetemplate

Both

metric

Server

monthlyfiscalcalendar

Both

msdyn_postalbum

Server

msdyn_postconfig

Server

msdyn_postruleconfig

Server

opportunity

Both

opportunityclose

Both

opportunityproduct

Both

orderclose

Both

ownermapping

Both

phonecall

Both

picklistmapping

Both

pluginassembly

Server

plugintype

Server

post

Server

postcomment

Server

postfollow

Server

postlike

Server

pricelevel

Both

principalobjectattributeaccess

Server

processsession

Both

product

Both

productpricelevel

Both

publisher

Server

publisheraddress

Server

quarterlyfiscalcalendar

Both

queue

Server

queueitem

Both

quote

Both

quoteclose

Both

quotedetail

Both

recurrencerule

Both

recurringappointmentmaster

Both

relationshiprole

Both

relationshiprolemap

Both

report

Server

reportcategory

Server

reportentity

Server

reportvisibility

Server

resourcespec

Both

role

Server

rollupfield

Server

salesliterature

Server

salesliteratureitem

Server

salesorder

Both

salesorderdetail

Both

savedquery

Server

savedqueryvisualization

Server

sdkmessageprocessingstep

Server

sdkmessageprocessingstepimage

Server

sdkmessageprocessingstepsecureconfig

Server

semiannualfiscalcalendar

Both

service

Server

serviceappointment

Both

serviceendpoint

Server

sharepointdocumentlocation

Server

sharepointsite

Server

site

Server

solution

Server

subject

Both

systemform

Server

task

Both

team

Server

template

Both

territory

Server

transactioncurrency

Server

transformationmapping

Both

transformationparametermapping

Both

uom

Server

uomschedule

Both

userentityinstancedata

Both

userentityuisettings

Both

userform

Server

userquery

Both

userqueryvisualization

Both

webresource

Server

workflow

Server

workflowdependency

Server

workflowlog

Server

See Also

OrganizationService Class
Microsoft.Xrm.Client.Services Namespace
Developer extensions context object model (Dynamics CRM 2015)
Developer extensions for Microsoft Dynamics CRM 2015

Return to top

© 2017 Microsoft. All rights reserved. Copyright