Advertisement
Guest User

Untitled

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