Socket
Socket
Sign inDemoInstall

node-ews

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ews

A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API


Version published
Weekly downloads
2.1K
increased by3.38%
Maintainers
1
Weekly downloads
 
Created
Source

node-ews

A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API
npm install node-ews
About

A extension of node-soap with httpntlm to make queries to Microsoft's Exchange Web Service API work.

Features:
  • Assumes NTLM Authentication over HTTPs
  • Connects to configured EWS Host and downloads it's wsdl file so it might be concluded that this is "fairly" version agnostic
  • After downloading the wsdl file, the wrapper dynamically exposes all EWS SOAP functions
  • Attempts to standardize Microsoft's wsdl by modifying the file to include missing service name, port, and bindings
Example 1: Get Exchange Distribution List Members Using ExpandDL
https://msdn.microsoft.com/EN-US/library/office/aa564755.aspx
var ews = require('node-ews');

// exchange server connection info
var username = 'myuser@domain.com';
var password = 'mypassword';
var host = 'ews.domain.com';

// exchange ews query on Public Distribution List by email
var ewsFunction = 'ExpandDL';
var ewsArgs = {
  'Mailbox': {
    'EmailAddress':'publiclist@domain.com'
  }
};

// ignore ssl verification (optional)
ews.ignoreSSL = true;

// setup authentication
ews.auth(username, password, host);

// query ews, print resulting JSON to console
ews.run(ewsFunction, ewsArgs, function(err, result) {
  if(!err) console.log(JSON.stringify(result));
});
Custom Soap Headers
ews.run('FindItem', {
  body: {
    attributes: {
      Traversal: 'Shallow'
    },
    ItemShape: {
      BaseShape: 'IdOnly',
      AdditionalProperties: {
        FieldURI: {
          attributes: {
            FieldURI: 'item:Subject'
          }
        }
      }
    },
    CalendarView: {
      attributes: {
        MaxEntriesReturned: 10,
        StartDate: '2016-01-01T00:00:00Z',
        EndDate: '2016-12-31T00:00:00Z'
      }
    },
    ParentFolderIds: {
      DistinguishedFolderId: {
        attributes: {
          Id: 'calendar'
        }
      }
    }
  },
  headers: {
    'http://schemas.microsoft.com/exchange/services/2006/types': [{
      RequestServerVersion: {
        attributes: {
          Version: 'Exchange2010'
        }
      },
      ExchangeImpersonation: {
        ConnectingSID: {
          SmtpAddress: '...'
        }
      }
    }]
  }
}, function(err, result) {});
Specifying XML processors

You can specify the XML processors you want to use when parsing the response. If you are seeing what should be Date/Times having values like '00Z', disable the stripPrefix processor that is run by default on the XML value by specifying:

ews.processors: {
  valueProcessors: null
}

Alternatively you can pass in an array of functions which will be merged with the default stripPrefix processor. Details can be found at the node-xml2js

Known Issues / Limits / TODOs:
  • Returned json requires a lot of parsing. Probably can be optimized to remove common parent elements to the EWS responses or dynamically filter based on query.
  • Outside of the example above, nothing has been tested (aka "It's production ready!")
  • Temp file cleanup logic needs to be validated to ensure file cleanup after process exit or object destruction

Keywords

FAQs

Package last updated on 04 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc