nmarus / node-ews

A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API.
MIT License
116 stars 52 forks source link

setOOO sends wrong headers #13

Closed jontowles closed 8 years ago

jontowles commented 8 years ago

Setting OOO sends the wrong headers.

It doesn't send the schema header for messages

nmarus commented 8 years ago

Please try the 2.0.0-dev branch and see if that resolves issues. Note this is a major rewrite and some command syntax is different.

nmarus commented 8 years ago

This is working on 2.0.0 Dev Branch. Testing Using Code Below:

var EWS = require('node-ews');

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

var options = {
  // rejectUnauthorized: false,
  // strictSSL: false
};

// initialize node-ews
var ews = new EWS(username, password, host, options);

var ewsFunction = 'SetUserOofSettings';
var ewsArgs = {
  'Mailbox': {
    'Address':'someemail@somedomain.com'
  },
  'UserOofSettings': {
    'OofState':'Enabled',
    'ExternalAudience':'All',
    'Duration': {
      'StartTime':'2016-08-22T00:00:00',
      'EndTime':'2016-08-23T00:00:00'
    },
    'InternalReply': {
      'Message':'I am out of office.  This is my internal reply.'
    },
    'ExternalReply': {
      'Message':'I am out of office. This is my external reply.'
    }
  }
};

// query ews, print resulting JSON to console
ews.run(ewsFunction, ewsArgs)
  .then(result => {
    console.log(JSON.stringify(result));
  })
  .catch(err => {
    console.log(err.stack);
  });

Console Output:

{"ResponseMessage":{"attributes":{"ResponseClass":"Success"},"ResponseCode":"NoError"}}