Last active
April 19, 2016 05:05
-
-
Save VibhuKuchhal/4c28574c1b2c2b0307f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ExchangeRepository() | |
{ | |
serviceInstance = new ExchangeService(ExchangeVersion.Exchange2007_SP1); | |
//Provide the account user credentials | |
serviceInstance.Credentials = new WebCredentials(ConfigurationManager.AppSettings["User"].ToString(), | |
ConfigurationManager.AppSettings["Password"].ToString(), | |
ConfigurationManager.AppSettings["Domain"].ToString()); | |
try | |
{ | |
// Use Autodiscover to set the URL endpoint. | |
serviceInstance.AutodiscoverUrl(ConfigurationManager.AppSettings["MailBox"].ToString()); | |
} | |
catch (Exception ex) | |
{ | |
serviceInstance = null; | |
ExceptionMessage = ex.Message; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment