Export (0) Print
Expand All
Expand Minimize

Delete Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

Deletes a business entity instance.

The relevant classes are specified in the following table.

TypeClass
RequestDeleteRequest
ResponseDeleteResponse
TargetTargetDelete
EntitySee the following table.

The following table shows the entities and target classes for this message.

EntityTarget class
Custom entityTargetDeleteX where X is the name of the entity
accountTargetDeleteAccount
activitymimeattachmentTargetDeleteActivityMimeAttachment
annotationTargetDeleteAnnotation
annualfiscalcalendarTargetDeleteAnnualFiscalCalendar
appointmentTargetDeleteAppointment
asyncoperationTargetDeleteAsyncOperation
attributemapTargetDeleteAttributeMap
bulkdeleteoperationTargetDeleteBulkDeleteOperation
bulkoperationTargetDeleteBulkOperation
businessunitnewsarticleTargetDeleteBusinessUnitNewsArticle
calendarTargetDeleteCalendar
campaignTargetDeleteCampaign
campaignactivityTargetDeleteCampaignActivity
campaignresponseTargetDeleteCampaignResponse
columnmappingTargetDeleteColumnMapping
competitorTargetDeleteCompetitor
constraintbasedgroupTargetDeleteConstraintBasedGroup
contactTargetDeleteContact
contractTargetDeleteContract
contractdetailTargetDeleteContractDetail
contracttemplateTargetDeleteContractTemplate
customeraddressTargetDeleteCustomerAddress
customeropportunityroleTargetDeleteCustomerOpportunityRole
customerrelationshipTargetDeleteCustomerRelationship
discountTargetDeleteDiscount
discounttypeTargetDeleteDiscountType
duplicateruleTargetDeleteDuplicateRule
duplicateruleconditionTargetDeleteDuplicateRuleCondition
DynamicEntityTargetDeleteDynamic
emailTargetDeleteEmail
equipmentTargetDeleteEquipment
faxTargetDeleteFax
fixedmonthlyfiscalcalendarTargetDeleteFixedMonthlyFiscalCalendar
importTargetDeleteImport
importfileTargetDeleteImportFile
importmapTargetDeleteImportMap
incidentTargetDeleteIncident
incidentresolutionTargetDeleteIncidentResolution
invoiceTargetDeleteInvoice
invoicedetailTargetDeleteInvoiceDetail
isvconfigTargetDeleteIsvConfig
kbarticleTargetDeleteKbArticle
kbarticlecommentTargetDeleteKbArticlecomment
kbarticletemplateTargetDeleteKbArticletemplate
leadTargetDeleteLead
letterTargetDeleteLetter
listTargetDeleteList
lookupmappingTargetDeleteLookUpMapping
monthlyfiscalcalendarTargetDeleteMonthlyFiscalCalendar
opportunityTargetDeleteOpportunity
opportunitycloseTargetDeleteOpportunityClose
opportunityproductTargetDeleteOpportunityProduct
ordercloseTargetDeleteOrderClose
ownermappingTargetDeleteOwnerMapping
phonecallTargetDeletePhoneCall
picklistmappingTargetDeletePickListMapping
pluginassemblyTargetDeletePluginAssembly
plugintypeTargetDeletePluginType
pricelevelTargetDeletePriceLevel
productTargetDeleteProduct
productpricelevelTargetDeleteProductPriceLevel
quarterlyfiscalcalendarTargetDeleteQuarterlyFiscalCalendar
queueTargetDeleteQueue
quoteTargetDeleteQuote
quotecloseTargetDeleteQuoteClose
quotedetailTargetDeleteQuoteDetail
relationshiproleTargetDeleteRelationshipRole
relationshiprolemapTargetDeleteRelationshipRoleMap
reportTargetDeleteReport
reportcategoryTargetDeleteReportCategory
reportentityTargetDeleteReportEntity
reportvisibilityTargetDeleteReportVisibility
resourcespecTargetDeleteResourceSpec
roleTargetDeleteRole
salesliteratureTargetDeleteSalesLiterature
salesliteratureitemTargetDeleteSalesLiteratureItem
salesorderTargetDeleteSalesOrder
salesorderdetailTargetDeleteSalesOrderDetail
savedqueryTargetDeleteSavedQuery
sdkmessageprocessingstepTargetDeleteSdkMessageProcessingStep
sdkmessageprocessingstepimageTargetDeleteSdkMessageProcessingStepImage
sdkmessageprocessingstepsecureconfigTargetDeleteSdkMessageProcessingStepSecureConfig
semiannualfiscalcalendarTargetDeleteSemiAnnualFiscalCalendar
serviceTargetDeleteService
serviceappointmentTargetDeleteServiceAppointment
siteTargetDeleteSite
subjectTargetDeletesubject
taskTargetDeleteTask
templateTargetDeleteTemplate
territoryTargetDeleteTerritory
transactioncurrencyTargetDeleteTransactionCurrency
transformationmappingTargetDeleteTransformationMapping
transformationparametermappingTargetDeleteTransformationParameterMapping
uomTargetDeleteUoM
uomscheduleTargetDeleteUoMSchedule
userqueryTargetDeleteUserQuery
workflowTargetDeleteWorkflow
workflowdependencyTargetDeleteWorkflowDependency
workflowlogTargetDeleteWorkflowLog

Remarks

To use this message, pass an instance of the DeleteRequest class as the request parameter in the Execute method.

When an entity instance is deleted, all child objects of the instance are also deleted. The entire deletion fails if the caller does not have the delete privilege for any of these child objects.

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

To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see Delete Privileges.

For better performance, use the Delete method instead of using this message.

Example

The following code example demonstrates how to delete a business entity instance.

[C#]
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the target object for the request.
TargetDeleteAccount target = new TargetDeleteAccount();
// EntityId is the GUID of the record being deleted.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Create the request object.
DeleteRequest delete = new DeleteRequest();
delete.Target = target;

// Execute the request.
DeleteResponse deleted = (DeleteResponse)service.Execute(delete);
[Visual Basic .NET]
' Set up the CRM Service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the target object for the request.
Dim target As New TargetDeleteAccount()
' EntityId is the GUID of the record being deleted.
target.EntityId = New Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

' Create the request object.
Dim delete As New DeleteRequest()
delete.Target = target

' Execute the request.
Dim deleted As DeleteResponse = CType(service.Execute(delete), DeleteResponse)

See Also

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft