‘Autodiscover service couldn’t be located’ when trying to access Exchange 2010 account with EWS MANAGED API

I am using Auto discover service Url for a specified e-mail address.

ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2010);
Service.Credentials = new WebCredentials("[email protected]", "Password");
Service.AutodiscoverUrl("[email protected]");
Folder inbox = Folder.Bind(Service, WellKnownFolderName.Inbox);
Console.WriteLine("The folder name is" + inbox.DisplayName.ToString());

If I do like this I’m gettin an error:

The Autodiscover service couldn’t be located

What I have to do to avoid this error?

You got Service.Credentials wrong, use it like this:

Service.Credentials = new WebCredentials(username, password, domainname);

Using domain credentials, not the email address.

Also doublecheck the following:

  1. The version you specify in new ExchangeService() matches server’s
  2. the parameter passed to Service.AutodiscoverUrl(); is correct (email address which data needs to be fetched)

The following works for me (in a new Console Application):

// Tweaked to match server version
ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); 

// Dummy but realistic credentials provided below
Service.Credentials = new WebCredentials("john", "12345678", "MYDOMAIN");
Service.AutodiscoverUrl("[email protected]");
Folder inbox = Folder.Bind(Service, WellKnownFolderName.Inbox);
Console.WriteLine("The folder name is " + inbox.DisplayName.ToString());

//Console output follows (IT localized environment, 'Posta in arrivo' = 'Inbox')
> The folder name is Posta in arrivo

8

Let me point out that if you are trying to access Office 365 then the web credentials really are of the form WebCredentials(strUsername, strPassword); with strUsername being the email address of the account you are trying to access.

I was getting this error and it turned out someone had changed the password on the account without informing me! What an odd error to get when it’s just a bad password!

2

I will recommend to you to enable Traces,to achieve this follow :

     Service.TraceEnabled = true;

I was facing the same issue then when I enabled traces these traces will guide you what exactly is happening.In my case SSL certificate issue is there to solve it i followed following post

There can be many issue such as:

  • User can be blocked.
  • The DNS can’t find autodiscover.domain.com.

2

For the record of completeness:

We encountered a service suddenly stopping with this particular error.
As the service had been running unattended for months, using EWS to monitor a mailbox, it turned out that the password was expired. This caused the AutoDiscovery to fail with the very same exception:

The Autodiscover service couldn’t be located

Updating the Exchange user’s password in the AD and checking its Password Never Expires property solved the problem for us.

1

I have used direct:

Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx")

and it worked for me. You may try use Fiddler and eM Client to see how they use EWS Managed API to get things done and replicate calls.

2

try to use this:

Service.Credentials = new WebCredentials("john", "12345678", "MYDOMAIN");

NOT this one

Service.Credentials = new WebCredentials("[email protected]", "12345678", "MYDOMAIN");

notice the username is 'john' NOT '[email protected]',It blocked me for quite a few hours for using the second one….

Check if the password for this email has expired.

If the password has expired you receive this error from AutoDiscover.

1

I’d recommend that you verify that autodiscover is actually setup in DNS. The following article explains how to set it up in more detail and it also gives you information on how to test it with the Microsoft Remote Connectivity Analyzer.http://www.petri.co.il/autodiscover-configuration-exchange-2010.htm

Faced this issue for specific user. After checking I found that user has enabled two factor authentication and using his primary password for connection. Solved by generating app specific password and connecting with it. Disabling two factor also worked, but it will take some time to reflect. Not sure why exchange gave “The Autodiscover service couldn’t be located.” instead of “Unauthorised”.

1

I experienced the same problem with Exchange 2013. In my case the cause was a Default Proxy declaration in my config file, which probably prevented the Autodiscover service to work correctly.

<system.net>
    <defaultProxy enabled="true">
      <proxy proxyaddress="http://localhost:8888" bypassonlocal="False"/>
    </defaultProxy>
</system.net>

After commenting the <defaultProxy> tag, autodiscover was able to find the service Url.

I have hit this and a trace shows that after using the proxy to access 365 it starts a DNS lookup for an SVC record.
This lookup goes to internal DNS and not the proxy, our internal DNS does not resolve external DNS entries, that is why we have proxy servers.
Not yet found out why it is doing a DNS lookup rather than using the proxy servers, but that is what is causing our version of this problem

The ‘Autodiscover service couldn’t be located’ error message could potentially be related to an authentication issue and not Autodiscover not working properly.

When I was getting started with the EWS Managed API, I was following Microsoft’s documentation and realized that their examples are still using Basic Authentication. However, as you can see in this blog post, Basic Auth should be turned off by end of 2022. So, instead of following exactly Microsoft’s code examples, you will have to modify the auth section to use OAuth 2.0. This article helped me get things to work.

Late to the party… But we had a similar problem. We received the same Autodiscover service couldn’t be located message and in checking the System Event Log, there was an error message stating that:

The password stored in Credential Manager is invalid.....

The error message also had instructions on how to correct. Namely, to go to Control Panel > Credential Manager and re-enter the password for the account in question. That solved it for us.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật