EWS Managed API Authentication with Exchange on-premise (NTLM)

Anna 0 Reputation points
2025-01-08T12:19:53.4766667+00:00

Hi!

Could you please guide me on how to use NTLM authentication for the Microsoft EWS API services with Exchange Server On-Premises? According to the documentation https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/authentication-and-ews-in-exchangeOn-Premise Exchange installations should use NTLM authentication. I have tried using the MSAL library for authentication, but if I am not mistaken, this is used for OAuth2, so it is not suitable for this case. My question is the following, if I am using NTLM does this mean the user will input their username & password in clear format and I will use NetworkCredential to authenticate him/her using the EWS Managed API library? Will the credentials be passed securely this way? This means that no cloud Identity provider is used as in OAuth2.

service.Credentials = new NetworkCredential("username", "password", "domain");

Could you please let me know if this is the correct approach please? In my case I do not want to use the Exchange on cloud or any cloud service like the identity provider for OAuth2. What is also the difference of NetworkCredential and WebCredentials? Now, this is what I am using, but is appropriate only for OAuth2 which is only available on cloud Exchange Server, and it is not what I need:

ExchangeService ewsService = new ExchangeService();
ewsService.UseDefaultCredentials = true;
ewsService.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
ewsService.Credentials = new OAuthCredentials(accessToken);

Could you please also confirm whether using OAuth requires and is mandatory to register your application on the Azure portal? Because we need to avoid using the cloud in all cases, as per our requirements.

Also as a side question, how am I supposed to determine what is the ewsService.URL for my On premise exchange server?

Many thanks,

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,400 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,753 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,747 questions
Microsoft Exchange
Microsoft Exchange
Microsoft messaging and collaboration software.
620 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
2,192 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.