How to Connect to the Marketing System
Your code must create a MarketingContext object before it can access Marketing System data. This section uses the Agent connection mode in all examples. See Campaign Concepts and Tasks for examples of the Local and Remote methods of creating the MarketingContext object.
To connect through Agent mode
Add the following project level references:
Microsoft.CommerceServer.CrossTierTypes Microsoft.CommerceServer.Marketing.CrossTierTypes
Use this reference in your code:
using Microsoft.CommerceServer; using Microsoft.CommerceServer.Marketing;
Create the MarketingContext object, connecting through the MarketingWebService in Agent mode:
//Set the URL to the Web service. string marketingWebServiceUrl = @"https://localhost/MarketingWebService/MarketingWebService.asmx"; // Create an instance of the Marketing System agent. MarketingServiceAgent ma = new MarketingServiceAgent (marketingWebServiceUrl); MarketingContext marketingSystem = MarketingContext.Create(ma);