AddItem Plugin Message (Campaign)

Adds an item to a campaign. The item added must be one of the following entity types: campaign, list, product, or salesliterature.

The relevant classes are specified in the following table.

Type                         Class

Request                     AddItemCampaignRequest

Response                  AddItemCampaignResponse

Entity                          campaign

Optional Parameters   RequestIdOptionalParameter

Remarks

To use this message, pass an instance of the AddItemCampaignRequest 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, seeAddItemCampaign Privileges.

  

//The following code example demonstrates how to add an item to a campaign.
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration.
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.
AddItemCampaignRequest add = new AddItemCampaignRequest();

// Set the properties of the request object.
add.CampaignId = new Guid("b4502053-6968-dc11-bb3a-0003ffbad8542");
add.EntityId = new Guid("b050f053-yur3-dc31-bb3a-0003ffbad37a");
add.EntityName = EntityName.product;
// Execute the request.
AddItemCampaignResponse added = (AddItemCampaignResponse)service.Execute(add);