This documentation is archived and is not being maintained.

CloneContract Message (CrmService)

Dynamics
banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment typesWorks online only

Copies an existing contract and its line items.

The relevant classes are specified in the following table.

TypeClass
RequestCloneContractRequest
ResponseCloneContractResponse
Entitycontract

Remarks

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

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

Example

The following code example demonstrates how to clone a contract.

[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 request object.
CloneContractRequest clone = new CloneContractRequest();

// Set the properties of the request object.
clone.ContractId = new Guid("C15AF217-C17E-DA11-B90F-000874DE7397");
clone.IncludeCanceledLines = false;
clone.ReturnDynamicEntities = false;

// Execute the request.
CloneContractResponse cloned = (CloneContractResponse) service.Execute(clone);
[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 request object.
Dim clone As New CloneContractRequest()

'Set the properties of the request object.
clone.ContractId = New Guid("C15AF217-C17E-DA11-B90F-000874DE7397")
clone.IncludeCanceledLines = False
clone.ReturnDynamicEntities = False

' Execute the request.
Dim cloned As CloneContractResponse = CType(service.Execute(clone), CloneContractResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show: