Delen via


How to Connect to the Marketing System

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

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

  1. Add the following project level references:

    Microsoft.CommerceServer.CrossTierTypes
    Microsoft.CommerceServer.Marketing.CrossTierTypes
    
  2. Use this reference in your code:

    using Microsoft.CommerceServer;
    using Microsoft.CommerceServer.Marketing;
    
  3. 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);
    

See Also

Other Resources

Marketing Management Scenarios