[英]Upgrade to O365 broke EWS Autodiscover
我公司只是將一些郵箱移至O365。 不幸的是,這破壞了使用EWS創建的應用程序。 嘗試調出AutodiscoverUrl()時,遇到錯誤。
“找不到自動發現服務。”
碼:
service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.UseDefaultCredentials = true;
service.AutodiscoverUrl(mailbox, RedirectionCallback);
private bool RedirectionCallback(string url)
{
return true;
}
我也嘗試將URL設置為以下內容
service.Url = new Uri("https://autodiscover.MYDOMAIN.com/autodiscover/autodiscover.xml");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
這些都沒有解決問題。 有人知道從這里去哪里嗎?
網址是https://outlook.office365.com/EWS/Exchange.asmx
public ExchangeService Connect() { var lastExchangeVersion = Enum.GetValues(typeof(ExchangeVersion)).Cast<ExchangeVersion>().ToList().Last(); var service = new ExchangeService(lastExchangeVersion) { Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx"), Credentials = new NetworkCredential(_cloudEmail, _cloudPassword) }; return service; } public SecureString ConvertStringToSecure(string password) { if (string.IsNullOrWhiteSpace(password)) return null; var result = new SecureString(); foreach (char c in password) result.AppendChar(c); return result; }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.