Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const EWS = require('node-ews');
- const CREDENTIALS = require('./credential');
- // exchange server connection info
- const ewsConfig = {
- username: CREDENTIALS.USERNAME,
- password: CREDENTIALS.PASSWORD,
- host: CREDENTIALS.HOST
- };
- // initialize node-ews
- const ews = new EWS(ewsConfig);
- // define ews api function
- const ewsFunction = 'GetFolder';
- // define ews api function args
- const ewsArgs = {
- 'FolderShape': {
- 'BaseShape': 'AllProperties'
- },
- 'FolderIds' : {
- 'DistinguishedFolderId': {
- 'attributes': {
- 'Id': 'calendar'
- }
- }
- }
- };
- // 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);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement