I am attempting to use Node.js to call the SOAP Exchange EWS services. I have created a simple http client like so:
var https = require('https');
var username = 'user';
var password = 'password';
var auth = 'NTLM ' + new Buffer(username + ":" + password).toString('base64');
var options = {
host : 'exchangehost',
port : 443,
method : 'post',
path : '/Exchange.asmx',
headers : { Authorization : auth }
};
var request = https.request(options, function(response) {
console.log('Status: ' + response.statusCode);
};
request.write('<soapenv:Envelope ...></soapenv:Envelope>');
request.end();
I receive a status code 401, I suspect because I am not doing the three steps involved for NTLM authentication (http://www.innovation.ch/personal/ronald/ntlm.html). Does anyone know of a Node.js module for communicating with Exchange EWS directly or for authenticating using NTLM, or am I going to need to implement that protocol for Node.js myself? Any assistance is greatly appreciated.
You can verify independently if a mailbox is accessible using EWS with the following steps: Go to https://testconnectivity.microsoft.com. If using Microsoft 365, click the Microsoft 365 tab. Select Service Account Access (Developers) then click Next.
On the Exchange Server hosting the Exchange Web Services open the Internet Information Services (IIS) Manager administrative tool. Navigate through to Server | Sites | Default Web Site | EWS. Select the Authentication icon from the feature view. Ensure that Basic Authentication is enabled.
This option can be useful when you don't have your Outlook app at hand. Still, in companies using Exchange Online, OWA and EWS can go hand-in-hand. For example, your employees can use OWA to check their emails, access their calendars, revise their To-Do lists, all without being on their device.
Exchange Web Services (EWS) is a cross-platform API that enables applications to access mailbox items such as email messages, meetings, and contacts from Exchange Online, Exchange Online as part of Office 365, or on-premises versions of Exchange starting with Exchange Server 2007.
I have used node-ews
successfully to communicate with EWS.
node-ews
uses httpntlm
internally for NTLM authentication.
Personally, I think node-ews is your best bet, since its pretty much already implemented everything you need to interact with EWS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With