Comparing version 2.1.3 to 2.1.4
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
var when = require('when'); | ||
@@ -193,3 +195,3 @@ var ntlm = require('httpntlm'); | ||
// run ews function with args | ||
EWS.prototype.run = function(ewsFunction, ewsArgs) { | ||
EWS.prototype.run = function(ewsFunction, ewsArgs, soapHeader) { | ||
@@ -221,2 +223,7 @@ var authProfile = this[this.auth].authProfile; | ||
// add optional soap header | ||
if(typeof soapHeader === 'object') { | ||
client.addSoapHeader(soapHeader); | ||
} | ||
// run ews soap function | ||
@@ -223,0 +230,0 @@ client[ewsFunction](ewsArgs, (err, result) => { |
{ | ||
"name": "node-ews", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -142,2 +142,42 @@ # node-ews | ||
#### 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: | ||
```js | ||
var EWS = require('node-ews'); | ||
// exchange server connection info | ||
var username = 'myuser@domain.com'; | ||
var password = 'mypassword'; | ||
var host = 'https://ews.domain.com'; | ||
// initialize node-ews | ||
var ews = new EWS(username, password, host); | ||
var ewsFunction = 'GetUserOofSettings'; | ||
var ewsArgs = { | ||
'Mailbox': { | ||
'Address':'email@somedomain.com' | ||
} | ||
}; | ||
var 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); | ||
}); | ||
``` | ||
#### Disable SSL verification: | ||
@@ -144,0 +184,0 @@ |
var EWS = require('node-ews'); | ||
// exchange server connection info | ||
var username = process.env.USERNAME; | ||
var password = process.env.PASSWORD; | ||
var host = process.env.EWS_URL; | ||
var username = 'nmarus'; | ||
var password = 'Cygnus775009'; | ||
var host = 'https://exchange.presidio.com'; | ||
@@ -11,37 +11,16 @@ // initialize node-ews | ||
// define a ews query on Public Distribution List by email | ||
// var ewsFunction = 'ExpandDL'; | ||
// var ewsArgs = { | ||
// 'Mailbox': { | ||
// 'EmailAddress': process.env.DL | ||
// } | ||
// }; | ||
var ewsFunction = 'GetUserOofSettings'; | ||
var ewsFunction = 'ExpandDL'; | ||
var ewsArgs = { | ||
'Mailbox': { | ||
'Address':'nmarus@presidio.com' | ||
'EmailAddress':'avvid@presidio.com' | ||
} | ||
}; | ||
ews.tempDir = '.'; | ||
// query ews, print resulting JSON to console | ||
ews.run(ewsFunction, ewsArgs) | ||
.then(result => { | ||
console.log(JSON.stringify(result.OofSettings)); | ||
console.log(JSON.stringify(result)); | ||
}) | ||
.catch(err => { | ||
console.log(err); | ||
console.log(err.message); | ||
}); | ||
setTimeout(() => { | ||
ews.run(ewsFunction, ewsArgs) | ||
.then(result => { | ||
console.log(JSON.stringify(result.OofSettings)); | ||
}) | ||
.catch(err => { | ||
console.log(err); | ||
}); | ||
}, 5000); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
706380
323
1
336