private void frmEmailCampaign_Load(object sender, EventArgs e) { try { string state = "ok"; _accessToken = OAuth.AuthenticateFromWinProgram(ref state); if (string.IsNullOrEmpty(_accessToken)) { Application.Exit(); } //initialize ConstantContact members IUserServiceContext userServiceContext = new UserServiceContext(_accessToken, _apiKey); ConstantContactFactory _constantContactFactory = new ConstantContactFactory(userServiceContext); _emailCampaignService = _constantContactFactory.CreateEmailCampaignService(); _emailCampaginScheduleService = _constantContactFactory.CreateCampaignScheduleService(); _listService = _constantContactFactory.CreateListService(); _accountService = _constantContactFactory.CreateAccountService(); } catch (OAuth2Exception oauthEx) { MessageBox.Show(string.Format("Authentication failure: {0}", oauthEx.Message), "Warning"); } PopulateCampaignTypeList(); PopulateListOfCountries(); PopulateUSAndCanadaListOfStates(); GetListOfContacts(); PopulateEmailLists(); }
public void LiveVerifiedEmailAddressTest() { var cc = new ConstantContactFactory(userServiceContext); var accountService = cc.CreateAccountService(); var list = accountService.GetVerifiedEmailAddress(); Assert.IsNotNull(list); Assert.AreNotEqual(0, list.Count); }