/// <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 e) { Console.WriteLine("Failed to create campaign. Exception says \"{0}\"", e.Message); } }
public CampaignSaveResult saveCampaign(Campaign campaign) { object[] results = this.Invoke("saveCampaign", new object[] {campaign}); return ((CampaignSaveResult) (results[0])); }