Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CancelContract Message (CrmService)
Collapse the table of content
Expand the table of content

CancelContract Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment typesWorks online and offline

Cancels a contract.

The relevant classes are specified in the following table.

TypeClass
RequestCancelContractRequest
ResponseCancelContractResponse
Entitycontract

Remarks

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

To perform this action, the caller must have access rights on the contract. For a list of required privileges, see CancelContract Privileges.

Example

[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 cancel request for a previously created contract
CancelContractRequest contactCancelationRequest = new CancelContractRequest();

// Set the properties for the request
contactCancelationRequest.ContractId = new Guid("C15AF217-C17E-DA11-B90F-000874DE7397");
contactCancelationRequest.CancelDate = new CrmDateTime();
contactCancelationRequest.CancelDate.Value = DateTime.Now.ToString();
contactCancelationRequest.Status = 5;

// Execute the request
service.Execute(contactCancelationRequest);
[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 cancel request for a previously created contract
Dim contactCancelationRequest As New CancelContractRequest()

' Set the properties for the request
contactCancelationRequest.ContractId = New Guid("C15AF217-C17E-DA11-B90F-000874DE7397")
contactCancelationRequest.CancelDate = New CrmDateTime()
contactCancelationRequest.CancelDate.Value = DateTime.Now.ToString()
contactCancelationRequest.Status = 5

' Execute the request
service.Execute(contactCancelationRequest)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft