Ejemplo n.º 1
0
        /// <summary>
        /// To create Connection to Microsoft Exchange by User Login and Password
        /// </summary>
        /// <param name="userInfo">The UserInfo is user login information: User name and Password</param>
        private void CreateConnection(UserInfo userInfo)
        {
            if (userInfo == null)
            {
                throw new NullReferenceException("Email Information don't in configuration file.");
            }

            try {
                _exchangeService = ExchangeServiceFactory.CreateExchangeService(userInfo);
            } catch (Exception) {
                //throw ex;
            }
        }
Ejemplo n.º 2
0
        private void BtnConnect_Click(object sender, EventArgs e)
        {
            if (validateControls())
            {
                var serviceUri = "https://outlook.office365.com/EWS/Exchange.asmx";//"https://mail-in.ey.net/ews/exchange.asmx";
                if (string.IsNullOrEmpty(txtDomain.Text.Trim()))
                {
                    exchangeService = ExchangeServiceFactory.GetExchangeWebClient(txtUserName.Text.Trim(),
                                                                                  txtPassword.Text.Trim(), txtEmailAddress.Text.Trim(), serviceUri);
                }
                else
                {
                    exchangeService = ExchangeServiceFactory.GetExchangeClient(txtUserName.Text.Trim(),
                                                                               txtPassword.Text.Trim(), txtDomain.Text.Trim(), txtEmailAddress.Text.Trim(), serviceUri);
                }

                this.BeginInvoke(new MethodInvoker(fetchFolder));
                this.BeginInvoke(new MethodInvoker(setDetailView));
            }
        }