Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const EWS = require('node-ews');
  2.  
  3. const CREDENTIALS = require('./credential');
  4. // exchange server connection info
  5. const ewsConfig = {
  6.   username: CREDENTIALS.USERNAME,
  7.   password: CREDENTIALS.PASSWORD,
  8.   host: CREDENTIALS.HOST
  9. };
  10.  
  11. // initialize node-ews
  12. const ews = new EWS(ewsConfig);
  13.  
  14. // define ews api function
  15. const ewsFunction = 'GetFolder';
  16.  
  17. // define ews api function args
  18. const ewsArgs = {
  19.   'FolderShape': {
  20.     'BaseShape': 'AllProperties'
  21.   },
  22.   'FolderIds' : {
  23.     'DistinguishedFolderId': {
  24.       'attributes': {
  25.         'Id': 'calendar'
  26.       }
  27.     }
  28.   }
  29. };
  30.  
  31. // define custom soap header
  32. const ewsSoapHeader = {
  33.   't:RequestServerVersion': {
  34.     attributes: {
  35.       Version: "Exchange2013"
  36.     }
  37.   }
  38. };
  39. // query ews, print resulting JSON to console
  40. ews.run(ewsFunction, ewsArgs, ewsSoapHeader)
  41.   .then(result => {
  42.  
  43.     console.log(JSON.stringify(result));
  44.   })
  45.   .catch(err => {
  46.     console.log(err.stack);
  47.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement