Search

Clone Message

Copies an existing contract and its line items.



//# The following code example demonstrates how to clone a contract.
// 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://:/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);