Closed rbartholomay closed 7 years ago
here's an example of impersonation for getting Out of Office settings for another user (tested on Office365)
var EWS = require('node-ews');
// exchange server connection info
var ewsConfig = {
username: the.admin@example.com,
password: the.adminpassword1234$,
host: 'https://outlook.office365.com',
auth: 'basic'
};
// initialize node-ews
var ews = new EWS(ewsConfig);
// define ews api function
var ewsFunction = 'GetUserOofSettings';
// define ews api function args
var ewsArgs = {
'Mailbox': {
'Address':'john.doe@example.com'
}
};
// define custom soap header
var ewsSoapHeader = {
't:ExchangeImpersonation': {
't:ConnectingSID': {
't:SmtpAddress': 'john.doe@example.com'
}
}
};
// query EWS and print resulting JSON to console
//ews.run(ewsFunction, ewsArgs)
ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
.then(result => {
console.log(JSON.stringify(result));
})
.catch(err => {
console.log(err.message);
});
Thanks! - This is a really nice library!
Closing due to inactivity.
Hi,
can you provide a sample how to use impersonation? And perhaps another example to open a shared mailbox?