Export (0) Print
Expand All
Expand Minimize

CopyCampaign Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online only

Copies a campaign.

The relevant classes are specified in the following table.

TypeClass
RequestCopyCampaign
ResponseCopyCampaign
Entitycampaign

Remarks

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

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

Example

The following sample code shows how to copy a campaign.

[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;

//Get the request to copy.
CopyCampaignRequest request = new CopyCampaignRequest();
   
//Assign the ID of the campaign you want to copy to the request.
request.BaseCampaign = new Guid("07D5B0B3-136C-48C6-8EAC-0030B9466E78");
   
// Execute the request.
CopyCampaignResponse response = (CopyCampaignResponse)service.Execute(request);
   
// Get the ID of the newly created copy.
Guid newCampaignID = response.CampaignCopyId;
[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

'Get the Requet to copy
Dim request As New CopyCampaignRequest()

'Assign the request the ID of the campaign we want to copy
request.BaseCampaign = campaignId
'SDK: request.BaseCampaign = New Guid("b050f053-6968-dc11-bb3a-0003ffbad37a")

' Execute the request.
Dim response As CopyCampaignResponse = CType(service.Execute(request), CopyCampaignResponse)

' Get the ID of the newly created copy
Dim newCampaignID As Guid = response.CampaignCopyId

See Also

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft