I'm getting above error message while connecting to Office365 .
ExchangeService serviceInstance = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
serviceInstance.Credentials = new WebCredentials("sample@microsoft.com", "Password", "REDMOND");
serviceInstance.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
foreach (EmailMessage email in serviceInstance.FindItems(WellKnownFolderName.Inbox, new ItemView(100)))
{
}
Both Username and Pwd are correct but still getting issue.
Kindly suggest.
You shouldn't be specifying the domain in
serviceInstance.Credentials = new WebCredentials("sample@microsoft.com", "Password", "REDMOND");
just use the user account upn only (and that maybe different from the Email Address)
serviceInstance.Credentials = new NetworkCredential("sample@microsoft.com", "Password");
or try the down-level format
serviceInstance.Credentials = new NetworkCredential("domain\\user\u0026quot;, "Password");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.