/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The Dfa user object running the code example.
    /// </param>
    public override void Run(DfaUser user) {
      // Create CampaignRemoteService instance.
      CampaignRemoteService service = (CampaignRemoteService) user.GetService(
          DfaService.v1_19.CampaignRemoteService);

      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
      string campaignName = _T("INSERT_CAMPAIGN_NAME_HERE");
      string url = _T("INSERT_LANDING_PAGE_URL_HERE");
      string landingPageName = _T("INSERT_LANDING_PAGE_NAME_HERE");

      // Create campaign structure.
      Campaign campaign = new Campaign();
      campaign.advertiserId = advertiserId;
      campaign.id = 0;
      campaign.name = campaignName;

      campaign.startDate = DateTime.Now;
      campaign.endDate = DateTime.Now.AddMonths(1);

      // Create & set default landing page.
      LandingPage defaultLandingPage = new LandingPage();
      defaultLandingPage.id = 0;
      defaultLandingPage.name = landingPageName;
      defaultLandingPage.url = url;

      try {
        campaign.defaultLandingPageId = service.saveLandingPage(defaultLandingPage).id;

        // Create campaign.
        CampaignSaveResult result = service.saveCampaign(campaign);

        // Display new campaign id.
        Console.WriteLine("Campaign with id \"{0}\" was created.", result.id);
      } catch (Exception ex) {
        Console.WriteLine("Failed to create campaign. Exception says \"{0}\"",
            ex.Message);
      }
    }
예제 #2
0
 public bool addLandingPageToCampaign(long nCampaignId, LandingPage[] landingPages) {
   object[] results = this.Invoke("addLandingPageToCampaign", new object[] {nCampaignId, landingPages});
   return ((bool) (results[0]));
 }
예제 #3
0
 public LandingPageSaveResult saveLandingPage(LandingPage landingPage) {
   object[] results = this.Invoke("saveLandingPage", new object[] {landingPage});
   return ((LandingPageSaveResult) (results[0]));
 }