Node.js integration with MS Exchange EWS

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.


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.


Have you tried the httpntlm module? https://github.com/SamDecrock/node-http-ntlm


Have you tried ews-javascript-api npm module, it has all the features you are looking at + very simple ntlm authentication using ews-javascript-api-auth module. NTLMv2 is also supported.

I added this as answer as it would provide complete answer to question title (integration). These are github links, question is little generic so samples provided at github readme should work.

[disclaimer - I am the author]

链接地址: http://www.djcxy.com/p/10410.html

上一篇: 将类的序列化放入DLL中

下一篇: Node.js与MS Exchange EWS的集成