示例#1
0
文件: Form1.cs 项目: lokygb/.net-sdk
        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();
        }
示例#2
0
        public void LiveVerifiedEmailAddressTest()
        {
            var cc = new ConstantContactFactory(userServiceContext);
            var accountService = cc.CreateAccountService();
            var list = accountService.GetVerifiedEmailAddress();

            Assert.IsNotNull(list);
            Assert.AreNotEqual(0, list.Count);
        }