Giter Club home page Giter Club logo

node-ews's Introduction

NOTE: This REPO is no longer being actively maintained.

=====================================

node-ews

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

Updates in 3.4.0 (new)

  • Use ntlm-client to enable NTLMv2

Updates in 3.2.0 (new)

  • Reverted back to official soap library to address workaround in issue #17
  • Added Notifications from PR #50 (See example 5)
  • Code cleanup

About

A extension of node-soap with ntlm-client to make queries to Microsoft's Exchange Web Service API work. Utilize node-soap for json to xml query processing and returns responses as json objects.

Features:
  • Supports NTLMv1, NTLMv2, Basic, or Bearer Authentication.
  • 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
  • This DOES NOT work with anything Microsoft Documents as using the EWS Managed API.
  • When using NTLMv2 you have to you your Windows username and not your email address

Example 1: Get Exchange Distribution List Members Using ExpandDL

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

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'ExpandDL';

// define ews api function args
const ewsArgs = {
  'Mailbox': {
    'EmailAddress':'[email protected]'
  }
};

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

Example 2: Setting OOO Using SetUserOofSettings

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

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'SetUserOofSettings';

// define ews api function args
const ewsArgs = {
  'Mailbox': {
    'Address':'[email protected]'
  },
  '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);
  });

Example 3: Getting OOO Using GetUserOofSettings

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

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'GetUserOofSettings';

// define ews api function args
const ewsArgs = {
  'Mailbox': {
    'Address':'[email protected]'
  }
};

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

Example 4: Sending Email (version 3.0.1 required to avoid issue #17)

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

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'CreateItem';

// define ews api function args
const ewsArgs = {
  "attributes" : {
    "MessageDisposition" : "SendAndSaveCopy"
  },
  "SavedItemFolderId": {
    "DistinguishedFolderId": {
      "attributes": {
        "Id": "sentitems"
      }
    }
  },
  "Items" : {
    "Message" : {
      "ItemClass": "IPM.Note",
      "Subject" : "Test EWS Email",
      "Body" : {
        "attributes": {
          "BodyType" : "Text"
        },
        "$value": "This is a test email"
      },
      "ToRecipients" : {
        "Mailbox" : {
          "EmailAddress" : "[email protected]"
        }
      },
      "IsRead": "false"
    }
  }
};

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

Example 5: Creating a Push Notification Service Listener

// specify listener service options
const serviceOptions = {
  port: 8080, // defaults to port 8000
  path: '/', // defaults to '/notification'
  // If you do not have NotificationService.wsdl it can be found via a quick Google search
  xml:fs.readFileSync('NotificationService.wsdl', 'utf8') // the xml field is required
};

// create the listener service
ews.notificationService(serviceOptions, function(response) {
  console.log(new Date().toISOString(), '| Received EWS Push Notification');
  console.log(new Date().toISOString(), '| Response:', JSON.stringify(response));
  // Do something with response
  return {SendNotificationResult: { SubscriptionStatus: 'OK' } }; // respond with 'OK' to keep subscription alive
  // return {SendNotificationResult: { SubscriptionStatus: 'UNSUBSCRIBE' } }; // respond with 'UNSUBSCRIBE' to unsubscribe
});

// The soap.listen object is passed through the promise so you can optionally use the .log() functionality
// https://github.com/vpulim/node-soap#server-logging
.then(server => {
  server.log = function(type, data) {
    console.log(new Date().toISOString(), '| ', type, ':', data);
  };
});

// create a push notification subscription
// https://msdn.microsoft.com/en-us/library/office/aa566188
const ewsConfig = {
  PushSubscriptionRequest: {
    FolderIds: {
      DistinguishedFolderId: {
        attributes: {
          Id: 'inbox'
        }
      }
    },
    EventTypes: {
      EventType: ['CreatedEvent']
    },
    StatusFrequency: 1,
    // subscription notifications will be sent to our listener service
    URL: 'http://' + require('os').hostname() + ':' + serviceOptions.port + serviceOptions.path
  }
};
ews.run('Subscribe', ewsConfig);

Office 365

Below is a template that works with Office 365.

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

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://outlook.office365.com',
  auth: 'basic'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'ExpandDL';

// define ews api function args
const ewsArgs = {
  'Mailbox': {
    'EmailAddress':'[email protected]'
  }
};

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

Advanced Options

Adding Optional Soap Headers

To add an optional soap header to the Exchange Web Services request, you can pass an optional 3rd variable to the ews.run() function as demonstrated by the following:

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

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'GetUserOofSettings';

// define ews api function args
const ewsArgs = {
  'Mailbox': {
    'Address':'[email protected]'
  }
};

// define custom soap header
const ewsSoapHeader = {
  't:RequestServerVersion': {
    attributes: {
      Version: "Exchange2013"
    }
  }
};

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

Enable Basic Auth instead of NTLM:

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com',
  auth: 'basic'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

Enable Bearer Auth instead of NTLM:

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  token: 'oauth_token...',
  host: 'https://ews.domain.com',
  auth: 'bearer'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

Disable SSL verification:

To disable SSL authentication modify the above examples with the following:

Basic and Bearer Auth

const options = {
 rejectUnauthorized: false,
 strictSSL: false
};
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

const ews = new EWS(config, options);

NTLM

const options = {
 strictSSL: false
};
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

const ews = new EWS(config, options);

Specify Temp Directory:

By default, node-ews creates a temp directory to store the xsd and wsdl file retrieved from the Exchange Web Service Server.

To override this behavior and use a persistent folder add the following to your config object.

// exchange server connection info
const ewsConfig = {
  username: '[email protected]',
  password: 'mypassword',
  host: 'https://ews.domain.com',
  temp: '/path/to/temp/folder'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

Constructing the ewsArgs JSON Object

Take the example of "FindItem" that is referenced in the Microsoft EWS API Docs as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
              Traversal="Shallow">
      <ItemShape>
        <t:BaseShape>IdOnly</t:BaseShape>
      </ItemShape>
      <ParentFolderIds>
        <t:DistinguishedFolderId Id="deleteditems"/>
      </ParentFolderIds>
    </FindItem>
  </soap:Body>
</soap:Envelope>

The equivalent JSON Request for node-ews (ewsArgs) would be:

{
  'attributes': {
    'Traversal': 'Shallow'
  },
  'ItemShape': {
    'BaseShape': 'IdOnly'
  },
  'ParentFolderIds' : {
    'DistinguishedFolderId': {
      'attributes': {
        'Id': 'deleteditems'
      }
    }
  }
}

It is important to note the structure of the request. Items such as "BaseShape" are children of their parent element. In this case it is "ItemShape". In regards "BaseShape" it is enclosed between an opening and closing tag so it is defined as a direct clid of "ItemShape".

However, "DistinguishedFolderId" has no closing tag and you must specify an ID. Rather than a direct child object, you must use the JSON child object "attributes".

License

MIT License Copyright (c) 2016 Nicholas Marus

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-ews's People

Contributors

alonrks avatar amaanm avatar antoine-aumjaud avatar chrisbroome avatar dependabot[bot] avatar jasonbbelcher avatar kcastrotech avatar nehab26 avatar nmarus avatar ricjd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-ews's Issues

fs.readFileSync() is not a function

After installing and including the node-ews in my ionic project, getting the error as " TypeError: Cannot read property 'prototype' of undefined" in graceful.js.

Anyone have come across this issue?

Single Result Returned

Take the below Soap request. I believe when this is converted into a JSON object the value of ItemId.Id is always the last listed item.

soap:Header
<t:RequestServerVersion Version="Exchange2010_SP1" />
</soap:Header>
soap:Body
<m:ExportItems>
<m:ItemIds>
<t:ItemId Id="AAMkAGYzZjZmRiUsidkC+NAAAAY89GAAA="/>
<t:ItemId Id="AAMkAGYzZjZmRiUsidkC+NAAAAY89FAAA="/>
<t:ItemId Id="AAMkAGYzZjZmRiUsidkC+NAAAAY87NAAA="/>
</m:ItemIds>
</m:ExportItems>
</soap:Body>

Anyway around this?

GetStreamingEvents returning undefined

I am only receiving undefined when my stream times out.

I use defineStream to subscribe to the inbox, sentitems, and calendar folder (arguments below). Then I initiate the stream. After 1 minute the stream closes, returns undefined, and my console logs '----- STREAM CONNECT ERROR -----'.

I await for the subscriptionId to be returned before I open the connection so I know its not that. I am wondering what else could be the issue?

public defineStream() {
        var ewsFunction = 'Subscribe';
        
        var ewsArgs = {
            'StreamingSubscriptionRequest': {
                'FolderIds' : {
                    'DistinguishedFolderId': [
                        {'attributes': {
                            'Id': 'inbox'
                        }},
                        {'attributes': {
                            'Id': 'sentitems'
                        }},
                        {'attributes': {
                            'Id': 'calendar'
                        }}
                    ]
                },
                'EventTypes': {
                    'EventType': ['CreatedEvent', 'ModifiedEvent']                   
                }
            }
        };
        //I Run ews here and get the subscriptionId.
    }

public initiateStream(subscriptionId) {
        var ewsFunction = 'GetStreamingEvents';
        
        var ewsArgs = {
            'SubscriptionIds': {
               'SubscriptionId':
                    subscriptionId
            },
            'ConnectionTimeout': '1'
        };
    
        this.ews.run(ewsFunction, ewsArgs, ExchangeConnector.ewsSoapHeader)
            .then(result => {
                console.log(JSON.stringify(result));;
                console.log('----- STREAM CONNECT SUCCESS -----')
            }).catch(err => {
                console.log(err.stack);
                console.log('----- STREAM CONNECT ERROR -----');
            })
}```

How to use the package in ionic2๏ผŸ

Hello,thank for your contribution,but after I install the package in my Ionic2 project,there is an error "cannot find module 'dns'",I spent two days trying fix it, could anybody give me some guide?

RangeError: Maximum call stack size exceeded

I'm running EWS function "UpdateItem" with arguments:

{
    attributes: {
        MessageDisposition: 'SaveOnly',
        ConflictResolution: 'AutoResolve'
    },
    ItemChanges: [{
        ItemChange: {
            ItemId: {
                attributes: {
                    Id: 'ATAUAGxsaW5kaGFyZHRAY2Jja2Mub3JnAEYAAAAAAI4eNWlSRatInnhuyOcnSIcHAPfFMAPpnn1HvotUdVcL/eIAAACqgs0AAImAA2RsA2BBpnhjzIcvvcEAANKuJAUAAA==',
                    ChangeKey: 'EwNAABYAAACJgANkbANgQaZ4Y8yHL73BAAFT2pmM'
                }
            },
            Updates: {
                SetItemField: {
                    FieldURI: {
                        attributes: {
                            FieldURI: "item:Categories"
                        },
                        Task: {
                            Categories: {
                                'String': ['Urgent!', 'Important!']
                            }
                        }
                    }
                }
            }
        }
    }]
}

and I'm getting:

C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1838
WSDL.prototype.findChildSchemaObject = function(parameterTypeObj, childName) {
^

RangeError: Maximum call stack size exceeded
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1838:48)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1881:19)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1881:19)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)
at WSDL.findChildSchemaObject (C:\leankit-exchanger\node_modules\soap\lib\wsdl.js:1887:20)

Attachment

Is there any way to attach files to sending mails?

GetUserAvailability issue

I am so glad to found your plug-in, actually it's the only one in which I can do calls to the EWS functions. Hoping you can help me cause I am trying to get the user availability and I get a request, but I think in some point the data is missing, I mean, the start and end time in the response I am seeing in StartTime and EndTime is always '00'

This is an example of the response:

{"Envelope":{"$":{"xmlns:s":"//schemas.xmlsoap.org/soap/envelope/"},"Header":[{"ServerVersionInfo":[{"$":{"MajorVersion":"15","MinorVersion":"0","MajorBuildNumber":"1156","MinorBuildNumber":"2","xmlns:h":"//schemas.microsoft.com/exchange/services/2006/types","xmlns":"//schemas.microsoft.com/exchange/services/2006/types","xmlns:xsd":"//www.w3.org/2001/XMLSchema","xmlns:xsi":"//www.w3.org/2001/XMLSchema-instance"}}]}],"Body":[{"$":{"xmlns:xsi":"//www.w3.org/2001/XMLSchema-instance","xmlns:xsd":"//www.w3.org/2001/XMLSchema"},"GetUserAvailabilityResponse":[{"$":{"xmlns":"//schemas.microsoft.com/exchange/services/2006/messages"},"FreeBusyResponseArray":[{"FreeBusyResponse":[{"ResponseMessage":[{"$":{"ResponseClass":"Success"},"ResponseCode":["NoError"]}],"FreeBusyView":[{"FreeBusyViewType":[{"_":"FreeBusy","$":{"xmlns":"//schemas.microsoft.com/exchange/services/2006/types"}}],"CalendarEventArray":[{"$":{"xmlns":"//schemas.microsoft.com/exchange/services/2006/types"},"CalendarEvent":[{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Tentative"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["OOF"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Tentative"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Busy"]},{"StartTime":["00"],"EndTime":["00"],"BusyType":["Tentative"]}]}],"WorkingHours":[{"$":{"xmlns":"//schemas.microsoft.com/exchange/services/2006/types"},"TimeZone":[{"Bias":["300"],"StandardTime":[{"Bias":["0"],"Time":["00"],"DayOrder":["1"],"Month":["11"],"DayOfWeek":["Sunday"]}],"DaylightTime":[{"Bias":["-60"],"Time":["00"],"DayOrder":["2"],"Month":["3"],"DayOfWeek":["Sunday"]}]}],"WorkingPeriodArray":[{"WorkingPeriod":[{"DayOfWeek":["Monday Tuesday Wednesday Thursday Friday"],"StartTimeInMinutes":["480"],"EndTimeInMinutes":["1020"]}]}]}]}]}]}]}]}]}}

And the args i am building to get it:
var ewsAvailFunction = 'GetUserAvailability';
var ewsAvail = {
'TimeZone':{
'Bias' : '480',
'StandardTime':{
'Bias':'0',
'Time':'02:00:00',
'DayOrder':'5',
'Month':'10',
'DayOfWeek':'Sunday'
},
'DaylightTime':{
'Bias':'300',
'Time':'02:00:00',
'DayOrder':'1',
'Month':'4',
'DayOfWeek':'Sunday'
}
},
'MailboxDataArray':{
'MailboxData':{
'Email':{
'Name':'',
'Address': '[email protected]',
'RoutingType':'SMTP'
},
'AttendeeType':'Organizer',
'ExcludeConflicts':'false'
}
},
'FreeBusyViewOptions':{
'TimeWindow':{
'StartTime':'2016-03-31T00:00:00',
'EndTime':'2016-04-02T00:00:00'
},
'MergedFreeBusyIntervalInMinutes':'30',
'RequestedView':'FreeBusy'
}
};

Please, let me know any thought!

Request for Feedback: Authentication methods available to node-ews

The latest version of node-ews has updates that make adding an alternative authentication method more modular. At the moment only NTLM is supported but there seem to be some open issues (ie #15) that I suspect are related to many implementations using basic-auth. While MS is saying that basic auth is not recommended, the reality is that this is not the case.

  1. I'm curious to know how many are running into issues because of basic auth limits in node-ews?

  2. Also, I'm looking for anyone that has access to a basic auth EWS setup that would be willing to create a test account for me to test/validate the basic auth mode that I am working on. This is currently implemented in the dev branch, but I have yet to test this and simply going on how other basic auth integrations I have built to other API services. Please message me at [email protected] if this is something you can provide. This may prove faster than me spinning up a lab Exchange server with basic auth on the EWS service.

Repeating XML items only pass the last item

Where the schema defines multiple entries with the same name, only the last one is used, for example FindItem includes
<t:AdditionalProperties> <t:FieldURI FieldURI="item:Subject" /> <t:FieldURI FieldURI="calendar:Start" /> <t:FieldURI FieldURI="calendar:End" /> </t:AdditionalProperties>
but if I code this as

'AdditionalProperties': { 'FieldURI': { 'attributes': { 'FieldURI': 'item:Subject', }, }, 'FieldURI': { 'attributes': { 'FieldURI': 'calendar:Start', } }, 'FieldURI': { 'attributes': { 'FieldURI': 'calendar:End', } } },

only the calendar:End attribute is returned in the reply.

CreateItem & UpdateItem Firing "Max call stack size exceeded"

First off - great module! I was able to tweak it to get a lot of functions working with EWS correctly (including FindItem, GetItem, Subscribe, GetEvents, ResolveNames, and also Impersonation ). It only took some minor tweaks to the code, but for the most part the xml2js & node-soap/wsdl.js handle the functions perfectly. That is until CreateItem (or UpdateItem). For some reason the following error fires:

if (Array.isArray(parameterTypeObj.$lookupTypes) && parameterTypeObj.$lookupTypes.length) {
^

RangeError: Maximum call stack size exceeded
at Function.isArray (native)
at WSDL.findChildSchemaObject (/../server/node-ews-rv/node-soap/lib/wsdl.js:1822:12)
at WSDL.findChildSchemaObject (/../server/node-ews-rv/node-soap/lib/wsdl.js:1862:20)

I can't for the life of me figure out what about these functions causes the error. I know the call stack exceeding has to do with (most likely) recursive functions, and .findChildSchemaObject does fire within itself in WSDL.js, but this has no effect on any other EWS operations but CreateItem & UpdateItem.

Any thoughts?

calling FindConversation with an IndexedPageItemView causes 500 error

When we pass an IndexedPageItemView to FindConversation, server responds with 500 error โ€“ "The request failed schema validation.".

Steps to reproduce:

  • make a FindConversation request, and be sure to include the IndexedPageItemView object.

eg:

ews.run("FindConversation", {
        attributes: {
            Traversal: "Deep"
        },
        IndexedPageItemView: {
            Offset: "10",
            BasePoint: "Beginning"
        },
        ParentFolderId: {
            DistinguishedFolderId: {
                attributes: {
                    Id: "root"
                }
            }
        },
        QueryString: "asdf"
    }, ewsSoapHeader);

Full error is:

Potentially unhandled rejection [5] Error: a:ErrorSchemaValidation: The request failed schema validation: The prefix 'ns1' is not defined. Line 1, position 480.
    at finish (/Users/zach.arend/Desktop/ews-sandbox/node_modules/soap/lib/wsdl.js:1488:21)
    at WSDL.xmlToObject (/Users/zach.arend/Desktop/ews-sandbox/node_modules/soap/lib/wsdl.js:1471:10)
    at parseSync (/Users/zach.arend/Desktop/ews-sandbox/node_modules/soap/lib/client.js:353:23)
    at /Users/zach.arend/Desktop/ews-sandbox/node_modules/soap/lib/client.js:346:14
    at Request._callback (/Users/zach.arend/Desktop/ews-sandbox/node_modules/soap/lib/http.js:118:5)
    at Request.self.callback (/Users/zach.arend/Desktop/ews-sandbox/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/Users/zach.arend/Desktop/ews-sandbox/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)

Edit: add full error and take out irrelevant property order info.

Date strings not parsing correctly

I have run into an issue where the parsing of calendar date strings inside XML values has not been working correctly due to the stripPrefix processor.
Something like <Start>2016-06-02T20:03:00Z</Start> ends up becoming { 'Start': '00Z' }

Will submit a PR

How to set Importance to High when sending e-mail?

Hi!
Trying to send an e-mail with importance set to high.
Been trying adding the following to your example code but none works.

Attempt 1:
"Importance": "hight"

Attemp 2:
"Importance: {"$value": "High"}

Any idea how to do this?

// Cheers B

Cannot login to exchange server

Greetings,

When I put in my credentials in the variables for this service, and then attempt to run the script, I get a NTLMStatusCode: 401 Unauthorized.

If I instead go to https://[SERVER]/EWS/Exchange.asmx in the browser , it prompts me for a login/password. It accepts my credentials, and then sends me to a page with a link to a .wsdl, the text "You have created a service." and some C#/VB code.

Is this related to the plain text issue others have been having? Or is this me missing something blindingly obvious?

Sincerely,
Josh

Adding BccRecipients

Hi, I am trying to add bcc recipients to the email.

My args are:


      let ewsFunction = 'CreateItem';

      let ewsArgs = {
        "attributes": {
          "MessageDisposition": "SendAndSaveCopy"
        },
        "SavedItemFolderId": {
          "DistinguishedFolderId": {
            "attributes": {
              "Id": "sentitems"
            }
          }
        },
        "Items": {
          "Message": {
            "ItemClass": "IPM.Note",
            "Subject": "I am test",
            "Body": {
              "attributes": {
                "BodyType": "HTML"
              },
              "$value": "<b>Heeloo</b>"
            },
            "ToRecipients": {
              "Mailbox": [
                  { "EmailAddress": "[email protected]"}
              ]
            },
            "BccRecipients": {
              "Mailbox": [
                 { "EmailAddress": "[email protected]"}
              ]
            },
            "IsRead": "false"
          }
        }
      };

     // query ews, print resulting JSON to console
      this.ews.run(ewsFunction, ewsArgs)
        .then(result => {
          resolve(result);
        })
        .catch(err => {
          logger.log('error', 'Email transport error ', {msg: err.message, code: err.code, stack: err.stack});
          reject(err);
        });

It works very well without BccRecipients, but when I add this node my server keeps responding (translated to english from german):

error: Email transport error msg = soap11: Client: Error checking pattern request: The 'Message' element in Namespace 'http://schemas.microsoft.com/exchange/services/2006/types' has an invalid subordinate element' BccRecipients' in Namespace 'http://schemas.microsoft.com/exchange/services/2006/types'. The list of possible elements was expected: 'IsResponseRequested, References, ReplyTo' in Namespace 'http://schemas.microsoft.com/exchange/services/2006/types'., Code = undefined, stack = Error: soap11: Client: Error in the schema check of the request: The 'Message' element in Namespace 'http://schemas.microsoft.com/exchange/services/2006/types' has an invalid subordinate element' BccRecipients' in Namespace 'http://schemas.microsoft .com / exchange / services / 2006 / types'. The list of possible elements was expected: 'IsResponseRequested, References, ReplyTo' in Namespace 'http://schemas.microsoft.com/exchange/services/2006/types'.

Can you please help me?

Need advice for setup

Hi,
Im trying to make a webservice for the office, where you can ask if any of the 8 meetings are available "now".
Im thinking I need to use the GetRoom or Roomlist, and the get appointment or Calender... Im not sure what they call the things i need to make this setup. I know the email address' for all of the meetingrooms.
Any pointers for what to do? I can easily check my own calender, its just the Room calender i cant find.

Multiple attendees not working

If I add multiple attendees to a meeting, or multiple resources, only the second one gets invited. This is because two attributes in an object can't have the same key, any workaround for this?

Exceptions while installing

When I run npm install node-ews, this will be the output:

`
$ npm install node-ews
npm WARN deprecated [email protected]: use uuid module instead

[email protected] install C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa
node-gyp rebuild
C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermโ–’glichen, mโ–’ssen Sie den Schalter "/m" hinzufโ–’gen.
ursaNative.cc
..\src\ursaNative.cc(157): warning C4244: "Argument": Konvertierung von "ssize_t" in "int", mโ–’glicher Datenverlust [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(172): warning C4244: "Argument": Konvertierung von "ssize_t" in "int", mโ–’glicher Datenverlust [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(378): warning C4267: "Initialisierung": Konvertierung von "size_t" nach "int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(379): warning C4267: "Initialisierung": Konvertierung von "size_t" nach "int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(686): warning C4267: "Argument": Konvertierung von "size_t" nach "int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(734): warning C4267: "Argument": Konvertierung von "size_t" nach "int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(779): warning C4267: "Argument": Konvertierung von "size_t" nach "int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(826): warning C4267: "Argument": Konvertierung von "size_t" nach "int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(945): warning C4267: "Argument": Konvertierung von "size_t" nach "unsigned int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
..\src\ursaNative.cc(1003): warning C4267: "Argument": Konvertierung von "size_t" nach "unsigned int", Datenverlust mโ–’glich [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
win_delay_load_hook.c
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: "__pfnDliNotifyHook2": Neudefinition; unterschiedliche Modifizierer [C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa\build\ursaNative.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: Siehe Deklaration von "__pfnDliNotifyHook2"
gyp ERR! build error
gyp ERR! stack Error: "C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe" failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\johndoe\repo.local\test\node_modules\node-ews\node_modules\soap\node_modules\ursa
gyp ERR! node -v v4.4.6
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN optional dep failed, continuing [email protected]
[email protected] node_modules\node-ews
โ”œโ”€โ”€ [email protected] ([email protected], [email protected])
โ”œโ”€โ”€ [email protected] ([email protected])
โ”œโ”€โ”€ [email protected] ([email protected])
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
โ”œโ”€โ”€ [email protected]
โ””โ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
`

Any ideas whats the problem here?
Ive run this on a Windows 10 machine. Also installed: Visual Studio 2015 Community Edition.

Fetching message content

Hello,

I can get the subject and sender content while trying to get an inbox full of unread emails. Is there any way to access the actual content of the email message. I tried sending some text and it doesnt show up on the jSON returned.

Thank You

CreateItem MessageDisposition="SendAndSaveCopy" canot set HTML <Body />

I followed your example:

var xml2js = require('xml2js');
var when = require('when');
var _ = require('lodash');

var util = require('util');

function convert(xml) {

  var attrkey = 'attributes';

  var parser = new xml2js.Parser({
    attrkey: attrkey,
    trim: true,
    ignoreAttrs: false,
    explicitRoot: false,
    explicitCharkey: false,
    explicitArray: false,
    explicitChildren: false,
    tagNameProcessors: [
      function(tag) {
        return tag.replace('t:', '');
      }
    ]
  });

  return when.promise((resolve, reject) => {
    parser.parseString(xml, (err, result) => {
      if(err) reject(err);
      else {
        var ewsFunction = _.keys(result['soap:Body'])[0];
        var parsed = result['soap:Body'][ewsFunction];
        parsed[attrkey] = _.omit(parsed[attrkey], ['xmlns', 'xmlns:t']);
        if(_.isEmpty(parsed[attrkey])) parsed = _.omit(parsed, [attrkey]);
        resolve(parsed);
      }
    });
  });

}

var xml = '<?xml version="1.0" encoding="utf-8"?>' +
  '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" ' +
                 'xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' +
    '<soap:Body>' +
      '<CreateItem MessageDisposition="SendAndSaveCopy" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
      '<SavedItemFolderId>' +
        '<t:DistinguishedFolderId Id="sentitems" />' +
      '</SavedItemFolderId>' +
      '<Items>' +
        '<t:Message>' +
          '<t:ItemClass>IPM.Note</t:ItemClass>' +
          '<t:Subject>EWS node email</t:Subject>' +
          '<t:Body BodyType="HTML">Priority - Update specification</t:Body>' +
          '<t:ToRecipients>' +
            '<t:Mailbox>' +
              '<t:EmailAddress>[email protected]</t:EmailAddress>' +
            '</t:Mailbox>' +
          '</t:ToRecipients>' +
          '<t:IsRead>false</t:IsRead>' +
        '</t:Message>' +
      '</Items>' +
    '</CreateItem>' +
    '</soap:Body>' +
  '</soap:Envelope>';

convert(xml).then(json => {
  console.log('ewsArgs = ' + util.inspect(json, false, null));
});

// console output ready for ewsArgs

// ewsArgs = { attributes: { MessageDisposition: 'SendAndSaveCopy' },
//  SavedItemFolderId: { DistinguishedFolderId: { attributes: { Id: 'sentitems' } } },
//  Items:
//   { Message:
//      { ItemClass: 'IPM.Note',
//        Subject: 'EWS node email',
//         Body:
//         { _: 'Priority - Update specification',
//           attributes: { BodyType: 'Text' } },
//        ToRecipients: { Mailbox: { EmailAddress: '[email protected]' } },
//        IsRead: 'false' } } }

However, I get the following error

Error: a:ErrorSchemaValidation: The request failed schema validation: The element 'http://schemas.microsoft.com/exchange/services/2006/types:Body' cannot contain child element 'http://schemas.microsoft.com/exchange/services/2006/types:HTML' because the parent element's content model is text only.
    at WSDL.xmlToObject (C:\dev\p\ms-exchange\ews\node_modules\node-ews\node_modules\soap\lib\wsdl.js:1467:19)
    at C:\dev\p\ms-exchange\ews\node_modules\node-ews\node_modules\soap\lib\client.js:297:25
    at C:\dev\p\ms-exchange\ews\node_modules\node-ews\lib\http.js:47:9
    at finalCallback (C:\dev\p\ms-exchange\ews\node_modules\httpreq\lib\httpreq.js:133:4)
    at IncomingMessage.<anonymous> (C:\dev\p\ms-exchange\ews\node_modules\httpreq\lib\httpreq.js:393:5)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

But, if I comment out the _ attribute, the email is sent. So, I do not know how to add the HTML body, or just text body at all.

Any suggestions?

Further testing

I'm planning on doing a <CreateItem MessageDisposition="SaveOnly"... and then an <UpdateItem... and report back.

Invalid or malformed wsdl file

I am getting:

Error: Invalid or malformed wsdl file: C:\Path\services.wsdl
    at C:\Path\node_modules\node-ews\lib\ews.js:197:20
    at tryToString (fs.js:455:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12)

when I try to send an email:

var EWS = require('node-ews')

// Exchange server connection info
var ewsConfig = {
username: 'username',
password: "password",
host: 'ews URL'
};

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; 

// initialize node-ews
var ews = new EWS(ewsConfig);

// define ews api function
var ewsFunction = 'CreateItem'

// define ews api function args
var ewsArgs = {
  "attributes" : {
    "MessageDisposition" : "SendAndSaveCopy"
  },
  "SavedItemFolderId": {
    "DistinguishedFolderId": {
      "attributes": {
        "Id": "sentitems"
      }
    }
  },
  "Items" : {
    "Message" : {
      "ItemClass": "IPM.Note",
      "Subject" : "Test EWS Email",
      "Body" : {
        "attributes": {
          "BodyType" : "Text"
        },
        "$value": "This is a test email"
      },
      "ToRecipients" : {
        "Mailbox" : {
          "EmailAddress" : "[email protected]"
        }
      },
      "IsRead": "false"
    }
  }
};

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

I believe I am connecting correctly since when I provide incorrect credentials I get a NTLM StatusCode 401: Unauthorized. error; this error does not occur when I provide correct credentials and instead I get the first error above: Invalid or malformed wsdl file.

When I go to the EWS URL endpoint in my browser, I can provide my credentials and then get access to a WSDL file thats about 1.6k lines long so I think perhaps there is something incompatible between this node and the WSDL?

If it helps: the Exchange 2010 sp1 server I'm attempting to interact with is hosted on an Azure VM and I can successfully interact with it using the EWS Managed API in an ASP.NET web app.

Is NTLMv2 Supported here?

Hello there,

I was wondering if NTLMv2 is supported by this package, and if not, what would i need to be looking at to change?

Thanks!

GetUserPhoto request

Hi! I am using your module and this time I want to get the photo: https://msdn.microsoft.com/en-us/library/office/jj190905(v=exchg.150).aspx but I see 2 things, in your api, I need to set the functions and the other is something in the structure, your body request is built like:

<soap:Body> <GetUserPhoto xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <GetUserPhoto> <Email>[email protected]</Email> <SizeRequested>HR360x360</SizeRequested> </GetUserPhoto> </GetUserPhoto></soap:Body></soap:Envelope>

the way to build it is like:

<soap:Body>
<m:GetUserPhoto>
<m:Email>[email protected]</m:Email>
<m:SizeRequested>HR360x360</m:SizeRequested>
</m:GetUserPhoto></soap:Body></soap:Envelope>

I did a little hack to change it but I get an error: ERROR: Error: Cannot parse response

Do you think is there any chance to retrieve it?

Thanks!

invalid child element 'Contains' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'."

Hey-oh guys!

Im trying to retrieve all the mails from my mailbox that contain CSAT on the subject,

Now, i am getting the following error:

"a:ErrorSchemaValidation: The request failed schema validation: The element 'FindItem' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'Contains' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'."

Here is my code:

var ewsFunction = 'FindItem';
var ewsArgs = {
    attributes: {
        Traversal: 'Shallow'
    },
    ItemShape: {
        BaseShape: 'IdOnly',
        AdditionalProperties: {
            FieldURI: {
                attributes: {
                    FieldURI: 'item:Subject'
                }
            }
        }
    },
    ParentFolderIds: {
        DistinguishedFolderId: {
            attributes: {
                Id: 'inbox'
            }
        }
    },
    Contains: {
      attributes: {
        ContainmentMode: 'Substring',
        ContainmentComparison: 'IgnoreCase'
      },
      FieldURI: {
          attributes: {
              FieldURI: 'item:Subject'
          }
      },
      Constant: {
          attributes: {
              Value: 'CSAT'
          }
      }
    },
    headers: {
        'http://schemas.microsoft.com/exchange/services/2010/types': [{
            RequestServerVersion: {
                attributes: {
                    Version: 'Exchange2010'
                }
            }
        }]
    }
};

Now, i think this issue is related to the versioning of the request, but, it doesn't matter what i put on the headers field, i always get the same error.

Now, do you know how to perform this search correctly?

Maximum call stack size exceeded

I was trying to send a mail using node-ews but i get this exception when i try to run the call:

Uncaught Exception:
RangeError: Maximum call stack size exceeded
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1902:48)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1951:20)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1951:20)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1951:20)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1951:20)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1945:19)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1951:20)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1951:20)
    at WSDL.findChildSchemaObject (/home/juan/workspace/persoMachine/node_modules/soap/lib/wsdl.js:1945:19)

....

  const ews = new EWS(username, password, host, options);
    var ewsSoapHeader = {
    't:RequestServerVersion': {
    attributes: {
    Version: "Exchange2010"
      }
     }
    };
    ewsFunction = "CreateItem";
    ewsArgs = {
      "attributes" : {
        "MessageDisposition" : "SendAndSaveCopy"
      },
      "SavedItemFolderId" : {
        "DistinguishedFolderId" : {
          "attributes" : {
            "Id" : "sentitems"
          }
        }
      },
      "Items" : {
        "Message" : {
          "Subject" : "[Code",
          "Body" : "Test",
          "ToRecipients" : {
            "Mailbox" : {
              "EmailAddress" : "[email protected]"
            }
          }
        }
      }
    };

    ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
      .then(result => {
       console.log("WE FUCKING DID IT");
        
      })
      .catch(err => {
       

      });

  });

I read about a simmilar incident on this issue-tracker, but attending to the resolution notes (that stated that if it happened again, one should open a new ticket altogether) i am opening this issue,

Thanks a lot! this is an amazing library :)

Support for Multiple XML elements? (Multiple Recipients)

This is my first exposure to EWS, and I'm using this to send out email through an exchange account. It works when I send to one recipient, but I am unable to send to multiple recipients.

How can I pass multiple recipients? Looks like the XML would just have repeat EmailAddress elements, but when I try that here it only sends to the first one. (I odn't believe JSON doesn't support like-named elements)

(Sorry Coffeescript here)

ewsArgs =
  attributes:
    MessageDisposition: "SendAndSaveCopy"
  SavedItemFolderId:
    DistinguishedFolderId:
      attributes:
        Id: "sentitems"
  Items:
    Message:
      ItemClass: "IPM.Note"
      Subject: "[Automation] Test email."
      Body:
        attributes:
          BodyType : "Text"
        $value: "This is a test email"
      ToRecipients:
        Mailbox:
          EmailAddress: "[email protected]"
      IsRead: false

Basic Auth enable if NTLM doesn't work

We would appreciate to implement support for basic auth functionality. For example, if we try with ntlm auth and we got and error (i.e. if we setup auth in exchange like on image below we will get an error )

screen shot 2016-06-02 at 17 31 29

then we would like to try basic auth automatically. If credentials are correct just we will continue with the process. Or we wish to implement flag functionality where we can choose which auth we want to use either ntlm or basic auth.

Is it possible and easy to implement these functionalities?

Can't create a calendar meeting with more than 2 attendees

I am trying to create meetings using the node-ews library. I am using this https://msdn.microsoft.com/en-us/library/office/dd633661(v=exchg.80).aspx

These are the arguments that I am sending to the function "Create Item"
{
"attributes": {
"SendMeetingInvitations": "SendToAllAndSaveCopy"
},
"SavedItemFolderId": {
"DistinguishedFolderId": {
"attributes": {
"Id": "calendar"
}
}
},
"Items": {
"CalendarItem": {
"Subject": "Test Meeting",
"Body": {
"attributes": {
"BodyType": "Text"
},
"$value": "Let's learn to really work as a team and then have lunch!"
},
"ReminderMinutesBeforeStart": "60",
"Start": "2017-08-28T23:00:00.000Z",
"End": "2017-08-29T00:00:00.000Z",
"Location": "Conf Room",
"RequiredAttendees": [
{
"Mailbox": {
"Address": "[email protected]"
}
},
{
"Mailbox": {
"Address": "[email protected]"
}
},
{
"Mailbox": {
"Address": "[email protected]"
}
}
],
"TimeZoneContext": {
"TimeZoneDefinition": {
"attributes": {
"Id": "Central Standard Time"
}
}
}
}
}
}

after sending this arguments the function only takes the first email and the last email only 2 emails are being added to the calendar meeting

EWS: Could not find schema information for the element

When I was trying to execute "GetRoomLists", without adding additional headers, at first a got an error with the message "You forgot to specify Exchange version ...."

screen shot 2016-06-02 at 13 40 13

after this I found solution and I changed my request as on below image:

screen shot 2016-06-02 at 12 52 02

After I specified version of my Exchange service I got an error as you can see on image below:

screen shot 2016-06-02 at 12 41 25

Do you know anything about this issue and how to solve this?

I'm using this lib locally, and my Exchange2013 is installed on local server machine so my domain and username is something like "[email protected]" and host is local ip address "192.168.50.192".

unable to get local issuer certificate

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

// exchange server connection info
let username = '****@****.**';
let password = '*****';
let host = 'https://mail.****.**';

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

let ewsFunction = 'GetUserOofSettings';
let ewsArgs = {
 'Mailbox': {
  'Address':'***@***.**'
 }
};

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

Catch error:

unable to get local issuer certificate
Error: unable to get local issuer certificate
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:1022:38)
    at emitNone (events.js:67:13)
    at TLSSocket.emit (events.js:166:7)
    at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:586:8)
    at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone

Error: unable to verify the first certificate

I'm having trouble trying to migrate to the latest version of the module (my exchange host worked with the previous one, after patching the node soap module).

Before I was using the exchange host without protocol (i.e. email.facundo.com). If I do that with the new version, I get:

Error: connect ECONNREFUSED 127.0.0.1:80
    at Object.exports._errnoException (util.js:890:11)
    at exports._exceptionWithHostPort (util.js:913:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1061:14)

If I specify the protocol, either http or https, I get this error instead:

Error: unable to verify the first certificate
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:1065:38)
    at emitNone (events.js:80:13)
    at TLSSocket.emit (events.js:179:7)
    at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:593:8)
    at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:425:38)

I've also tried passing {strictSSL: false, rejectUnauthorized: false} but the result is the same.

xml to json with array

Hi, Im trying to get meeting appointments
But It fails to get the Subject, Start and End form the calendar

So this

<t:AdditionalProperties>
  <t:FieldURI FieldURI="item:Subject" />
  <t:FieldURI FieldURI="calendar:Start" />
  <t:FieldURI FieldURI="calendar:End" />
</t:AdditionalProperties>

becomes:

'AdditionalProperties':{
      "FieldURI": [
         {"FieldURI": "item:Subject"},
         {"FieldURI": "calendar:Start"},
         {"FieldURI": "calendar:End"}
      ]
    }

But then it fails to find the FieldURI
a:ErrorSchemaValidation: The request failed schema validation: The required attribute 'FieldURI' is missing.

Any ideas?

Allow disabling of SSL checking

I work on a corporate intranet with self-signed certs, and I imagine this is a moderately common scenario.

I'd be willing to work on this; I just wanted to set up an issue first so if anyone else is interested then we can coordinate efforts.

The required attribute 'Traversal' is missing.

Hi there,

First of all, node-ews is amazing, im really looking forward to unleahs its potential :)

Now, im getting the following following error message on my electron app:

"a:ErrorSchemaValidation: The request failed schema validation: The required attribute 'Traversal' is missing."

I understand i have to set the Traversal attribute on the ewsArgs, but im not sure how.

Im trying the following:

var ews = new EWS(username, password, host, options);

// Get Mails
var ewsFunction = 'FindItem';
var ewsArgs = {
  'Traversal' : 'Shallow',
  'ItemShape': {
    'BaseShape':'IdOnly'
  },
  'ParentFolderIds' : {
    'DistinguishedFolderId' : 'deleteditems'
  }
};

before the ews run in an attempt to replicate the following soap call:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
              Traversal="Shallow">
      <ItemShape>
        <t:BaseShape>IdOnly</t:BaseShape>
      </ItemShape>
      <ParentFolderIds>
        <t:DistinguishedFolderId Id="deleteditems"/>
      </ParentFolderIds>
    </FindItem>
  </soap:Body>
</soap:Envelope> 

So, how can i set the Traversal attribute that is right on the findItem tag?

Now, thanks a lot for your help, and for developing this,

UpdateItem calls take an excessively long time (5-17 seconds)

In my application it takes a long time to make calls to node-ews because parsing the javascript object into soap xml is slow. The worst offender is UpdateItem which spends 5-17 seconds converting the object to xml. Any thoughts on how to combat this. I know this is an issue with node-soap. Any thought to using a faster library?

I can't make our customers wait 17 seconds to update the descriptions their calendar calendar items, and I would really appreciate help with this.

see also
#17

Here is an example request:

  "attributes": {
    "ConflictResolution": "AlwaysOverwrite",
    "SendMeetingInvitationsOrCancellations": "SendToChangedAndSaveCopy"
  },
  "ItemChanges": {
    "ItemChange": {
      "ItemId": {
        "attributes": {
          "Id": "AAMkAGI0MGNiODlkLTIyZDctNDk0ZS04ZDE0LWQ0MjM3NjY4NDEwNgBGAAAAAADyy9tCz3czRKC9BEcqsw4bBwD0GQKYODa9T6eBwEWaUM/rAAAAAAENAAD0GQKYODa9T6eBwEWaUM/rAADyWJ3JAAA="
        }
      },
      "Updates": {
        "SetItemField": [
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "item:Subject"
              }
            },
            "CalendarItem": {
              "Subject": "shit2"
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "item:Sensitivity"
              }
            },
            "CalendarItem": {
              "Sensitivity": "Normal"
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "item:Body"
              }
            },
            "CalendarItem": {
              "Body": {
                "attributes": {
                  "BodyType": "Text"
                },
                "$value": "fuck shitasdfjkl;ajsdkflasjdfklas;dfjkalsd;fajlskd;fjaksld;fjkasd;fajskdl;fjaskld;fjaskdfjas;ldfjk\najskdfl;ajskdlf;ajsdklf;jaskdl;fjaskld;fjaksl;dfjklas;dfjkjsdfkasdjfklasdjflkasdf\nasdjkfl fuck you exchange\nasdjfkasldf"
              }
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "item:ReminderIsSet"
              }
            },
            "CalendarItem": {
              "ReminderIsSet": "false"
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "calendar:Start"
              }
            },
            "CalendarItem": {
              "Start": "2017-08-23T02:00:00-07:00"
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "calendar:End"
              }
            },
            "CalendarItem": {
              "End": "2017-08-23T02:30:00-07:00"
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "calendar:IsAllDayEvent"
              }
            },
            "CalendarItem": {
              "IsAllDayEvent": "false"
            }
          },
          {
            "FieldURI": {
              "attributes": {
                "FieldURI": "calendar:Location"
              }
            },
            "CalendarItem": {
              "Location": ""
            }
          }
        ]
      }
    }
  }
});

xml to json

hey guys,
i can't figure how to write the body attribtue in this soap request (https://msdn.microsoft.com/en-us/library/office/aa566468(v=exchg.150).aspx) to json.
i tried different solutions as :
'Body' : {
'Attributes' : {
'BodyType' : 'Text'
},
'Body' : 'Hello !'
}
but i keep getting this error :
WSDL.prototype.findChildSchemaObject = function(parameterTypeObj, childName) {
RangeError: Maximum call stack size exceeded
at WSDL.findChildSchemaObject (/srv/node/odj/node_modules/soap/lib/wsdl.js:1902:48)
...

any idea how to write that body correctly ?

thanks

I think there's a mistake

I think there's a mistake.

ntlm[method](options, function(err, res) {
  if(err) {
    callback(**error**);
  } else {
    var body = res.body;
    if (typeof body === "string") {
      // Remove any extra characters that appear before or after the SOAP
      // envelope.
      var match = body.match(/(?:<\?[^?]*\?>[\s]*)?<([^:]*):Envelope([\S\s]*)<\/\1:Envelope>/i);
      if (match) {
        body = match[0];
      }
    }
    callback(null, res, body);
  }
});

/xxx/node_modules/node-ews/lib/http.js:36
callback(error);

ReferenceError: error is not defined
at /xxx/node_modules/node-ews/lib/http.js:36:18
at finalCallback (/xxx/node_modules/node-ews/node_modules/httpntlm/node_modules/httpreq/lib/httpreq.js:133:4)
at ClientRequest. (/xxx/node_modules/node-ews/node_modules/httpntlm/node_modules/httpreq/lib/httpreq.js:436:3)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketOnEnd (_http_client.js:288:9)
at emitNone (events.js:72:20)
at Socket.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at doNTCallback2 (node.js:441:9)

Streaming Request?

I'm playing around with the EWS streaming subscription and am wondering if there is a way to access the streaming request as data comes in instead of waiting until it finishes?

For example, if I create a subscription then use the "GetStreamingEvents" function like so:

		ews.run("GetStreamingEvents",{
			SubscriptionIds:{
				SubscriptionId:this.subscriptionId
			},
			ConnectionTimeout:1
		}).then(events => {
			//Do something with events
		}, err => {
			//Ooops, something went wrong!
		});

The "then(events => {..." isn't called until after the connection times out (e.g. 1 minute) and the response at that point contains multiple envelopes with or without events:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:Notifications>
						<m:Notification>
							<t:SubscriptionId>FQBjYmNkY21haWwwMy5jYmNrYy5vcmcQAAAAvxnM8b2nh0C6cdPzWYkpp2wPU82pgtQIEAAAACGRLXGSJlZJn4ZVwqpDTtI=</t:SubscriptionId>
							<t:CreatedEvent>
								<t:TimeStamp>2017-04-13T20:15:37Z</t:TimeStamp>
								<t:ItemId Id="AAH8Bh99AAA=" ChangeKey="CQAAAA==" />
								<t:ParentFolderId Id="AAAqoK/AAA=" ChangeKey="AQAAAA==" />
							</t:CreatedEvent>
							<t:NewMailEvent>
								<t:TimeStamp>2017-04-13T20:15:37Z</t:TimeStamp>
								<t:ItemId Id="yHL73BAAH8Bh99AAA=" ChangeKey="CQAAAA==" />
								<t:ParentFolderId Id="AAAAqoK/AAA=" ChangeKey="AQAAAA==" />
							</t:NewMailEvent>
							<t:ModifiedEvent>
								<t:TimeStamp>2017-04-13T20:15:37Z</t:TimeStamp>
								<t:FolderId Id="3iAAqoK/AAA=" ChangeKey="AQAAAA==" />
								<t:ParentFolderId Id="3iAAAAqoK8AAA=" ChangeKey="AQAAAA==" />
								<t:UnreadCount>2</t:UnreadCount>
							</t:ModifiedEvent>
						</m:Notification>
					</m:Notifications>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:ConnectionStatus>OK</m:ConnectionStatus>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:ConnectionStatus>OK</m:ConnectionStatus>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:Notifications>
						<m:Notification>
							<t:SubscriptionId>FQBjYmNkY21haWwwMy5jYmNrYy5vcmcQAAAAvxnM8b2nh0C6cdPzWYkpp2wPU82pgtQIEAAAACGRLXGSJlZJn4ZVwqpDTtI=</t:SubscriptionId>
							<t:ModifiedEvent>
								<t:TimeStamp>2017-04-13T20:16:59Z</t:TimeStamp>
								<t:ItemId Id="AA99AAA=" ChangeKey="CQAAAA==" />
								<t:ParentFolderId Id="AAMkADc/AAA=" ChangeKey="AQAAAA==" />
							</t:ModifiedEvent>
							<t:ModifiedEvent>
								<t:TimeStamp>2017-04-13T20:16:59Z</t:TimeStamp>
								<t:FolderId Id="AAMkAAAA=" ChangeKey="AQAAAA==" />
								<t:ParentFolderId Id="AAMoK8AAA=" ChangeKey="AQAAAA==" />
								<t:UnreadCount>1</t:UnreadCount>
							</t:ModifiedEvent>
						</m:Notification>
					</m:Notifications>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:ConnectionStatus>OK</m:ConnectionStatus>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:ConnectionStatus>OK</m:ConnectionStatus>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<soap11:Header xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<ServerVersionInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1076" MinorBuildNumber="9" Version="V2_22" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
	</soap11:Header>
	<soap11:Body xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">
		<m:GetStreamingEventsResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
			<m:ResponseMessages>
				<m:GetStreamingEventsResponseMessage ResponseClass="Success">
					<m:ResponseCode>NoError</m:ResponseCode>
					<m:ConnectionStatus>Closed</m:ConnectionStatus>
				</m:GetStreamingEventsResponseMessage>
			</m:ResponseMessages>
		</m:GetStreamingEventsResponse>
	</soap11:Body>
</Envelope>

So what I need to do is tap into the request as it's running and parse the streaming data as it comes in.

I've been digging through the node-ews and node-soap code but am not seeing anything that can allow me to do that without forking it. I was hoping someone here may have another idea or knows of something that I've missed?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.