Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExchangeService.AutodiscoverUrl fails #90

Open
Krimsondk opened this issue Apr 30, 2018 · 0 comments
Open

ExchangeService.AutodiscoverUrl fails #90

Krimsondk opened this issue Apr 30, 2018 · 0 comments

Comments

@Krimsondk
Copy link

Since moving our Exchange installation to Office 365 the ExchangeService.AutodiscoverUrl (from within EWSConnectionManger.ConnectToEWS) call have started to fail. I get the following exception:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at System.DirectoryServices.ResultPropertyValueCollection.get_Item(Int32 index)
at Microsoft.Exchange.WebServices.Autodiscover.DirectoryHelper.GetScpUrlList(String domainName, String ldapPath, Int32& maxHops)
at Microsoft.Exchange.WebServices.Autodiscover.DirectoryHelper.GetAutodiscoverScpUrlsForDomain(String domainName)
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetAutodiscoverServiceUrls(String domainName, Int32& scpHostCount)
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetAutodiscoverServiceHosts(String domainName, Int32& scpHostCount)
at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetSettings[TGetSettingsResponseCollection,TSettingName](List1 identities, List1 settings, Nullable1 requestedVersion, GetSettingsMethod2 getSettingsMethod, Func1 getDomainMethod) at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(List1 smtpAddresses, List1 settings) at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetSoapUserSettings(String smtpAddress, List1 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 Mail2Bug.Email.EWS.EWSConnectionManger.ConnectToEWS(Credentials credentials, Boolean useConversationGuidOnly) in C:\Projects\GitHub\mail2bug\Mail2Bug\Email\EWS\EWSConnectionManger.cs:line 91
at Mail2Bug.Email.EWS.EWSConnectionManger.GetConnection(Credentials credentials, Boolean useConversationGuidOnly) in C:\Projects\GitHub\mail2bug\Mail2Bug\Email\EWS\EWSConnectionManger.cs:line 61
at Mail2Bug.Email.MailboxManagerFactory.CreateMailboxManager(EmailSettings emailSettings) in C:\Projects\GitHub\mail2bug\Mail2Bug\Email\MailboxManagerFactory.cs:line 31
at Mail2Bug.Mail2BugEngine..ctor(InstanceConfig configInstance, MailboxManagerFactory mailboxManagerFactory) in C:\Projects\GitHub\mail2bug\Mail2Bug\Mail2BugEngine.cs:line 31
at Mail2Bug.MainApp.InitInstances(IEnumerable`1 configs) in C:\Projects\GitHub\mail2bug\Mail2Bug\Main.cs:line 214

I can replicate this by newing up a ExchangeService and calling AutodiscoverUrl outside Mail2Bug.

If I use the Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService class instead, then I can get the URL to the mailbox, which I can use to set the ExchangeService.Url property and this works.

Would it be possible to have a setting which specifies that the AutodiscoverService class should be used instead of the AutodiscoverUrl method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant