Skip to content

bstoney/exchanger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Query Microsoft's Exchange Web Services. Only tested on Microsoft Exchange 2010. With asynchronous promises.

##Install

Install with npm:

npm install exchanger

##Module

###exchanger.initialize(settings)

  var exchanger = require('exchanger');
  exchanger.initialize({ url: 'webmail.example.com', username: 'username', password: 'password' })
    .then(function(client) {
        console.log('Initialized!');
    });

###exchanger.getEmails(client, folderName, limit, emailAddress)

  var exchanger = require('exchanger');
  exchanger.initialize({ url: 'webmail.example.com', username: 'username', password: 'password' })
    .then(function(client) {
        return exchanger.getEmails(client, 'inbox', 50, '[email protected]');
    })
    .then(function(emails){
        console.log(emails);
    });

###exchanger.getEmail(client, id)

  var exchanger = require('exchanger');
  exchanger.initialize({ url: 'webmail.example.com', username: 'username', password: 'password' })
    .then(function(client) {
        return [client, exchanger.getEmails(client, 'inbox', 50, '[email protected]')];
    })
    .then(function(client, emails){
        return exchanger.getEmail(client, emails[0].id);
    })
    .then(function(email){
        console.log(email);
    });

###exchanger.getFolders(client, folderName, emailAddress)

    var exchanger = require('exchanger');
    exchanger.initialize({ url: 'webmail.example.com', username: 'username', password: 'password' })
        .then(function(client) {
            return exchanger.getFolders(client, 'inbox', '[email protected]');
        })
        .then(function(folders){
            console.log(folders);
        });

##Support for callbacks rather then promises

    var exchanger = require('exchanger').withCallbacks;
    exchanger.initialize({ url: 'webmail.example.com', username: 'username', password: 'password' }, function(err) {
        console.log(err);
        exchanger.getEmails('inbox', 50, '[email protected]', function(err, emails){
            if(err){
                console.log(err);
                return;
            }

            console.log(emails);
        });
    });

###Other Information EWS reference for Exchange

About

Query Exchange Web Services

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%