无法在O365身份验证中找到自动发现服务

时间:2019-03-19 14:31:57

标签: c# office365

我正在使用Microsoft.Exchange.WebServices连接到Office 365

我正在使用模拟选项,并尝试使用Admin凭据访问用户邮箱。

  objExchangeService.TraceEnabled = false;
                            f_objExchangeService.EnableScpLookup = false;
                            f_objExchangeService.Credentials = new WebCredentials(p_office365UserId, p_office365UserPassword);

     ImpersonatedUserId f_objImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, p_ImpersonatedUserID);
                            f_objExchangeService.ImpersonatedUserId = _objImpersonatedUserId;

                            f_objExchangeService.AutodiscoverUrl(p_ImpersonatedUserID, RedirectionUrlValidationCallback);

此方法返回错误

  

找不到自动发现服务

堆栈跟踪如下

 at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings[TSettings](String emailAddress, List`1 redirectionEmailAddresses, Int32& currentHop)
   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetLegacyUserSettings[TSettings](String emailAddress)
   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings(String emailAddress, List`1 requestedSettings)
   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(String userSmtpAddress, UserSettingName[] userSettingNames)
   at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAutodiscoverUrl(String emailAddress, ExchangeVersion requestedServerVersion, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
   at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
   at Office365EWSWriter.Office365Engine.Authenticate(String p_office365UserId, String p_office365UserPassword, ExchangeVersion p_serverVersion, String p_ImpersonatedUserID)

0 个答案:

没有答案