This documentation is archived and is not being maintained.

RemoveItemCampaign Message (CrmService)

Forefront
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

Removes an item from a campaign.

The relevant classes are specified in the following table.

TypeClass
RequestRemoveItemCampaignRequest
ResponseRemoveItemCampaignResponse
Entitycampaign

Remarks

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

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

Example

The following code example shows how to use the RemoveItemCampaign message.

[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.
RemoveItemCampaignRequest remove = new RemoveItemCampaignRequest();

// Set the ID of the campaign.
remove.CampaignId =  new Guid("d7f33457-660e-de11-bf40-00155da4c706");

// Set the ID of the campaign item to remove.
remove.EntityId =  new Guid("6e47aeb7-c30d-de11-bf40-00155da4c706");

// Execute the request.
RemoveItemCampaignResponse removed = 
    (RemoveItemCampaignResponse)service.Execute(remove);
[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 remove As New RemoveItemCampaignRequest()

' Set the ID of the campaign.
remove.CampaignId =  New Guid("d7f33457-660e-de11-bf40-00155da4c706")

' Set the ID of the campaign item to remove.
remove.EntityId =  New Guid("6e47aeb7-c30d-de11-bf40-00155da4c706")

' Execute the request.
Dim removed As RemoveItemCampaignResponse = CType(service.Execute(remove), RemoveItemCampaignResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show: