locked
Connect Node service with Office 365 Mail Box RRS feed

  • Question

  • I'm facing issues while trying to read mail from Office 365 account.
    Below is the code I'm using:

    const EWS = require('node-ews');
     
    // exchange server connection info
    const ewsConfig = {
      username: 'myuser@myDomain.com',
      password: 'mypassword',
      host: 'https://outlook.office365.com/owa/myDomain.com/',
      auth: 'basic'
    };
     
    // initialize node-ews
    const ews = new EWS(ewsConfig);
     
    // define ews api function
    const ewsFunction = 'ExpandDL';
     
    // define ews api function args
    const ewsArgs = {
      'Mailbox': {
        'EmailAddress':'publiclist@domain.com'
      }
    };
     
    // query EWS and print resulting JSON to console
    ews.run(ewsFunction, ewsArgs)
      .then(result => {
        console.log(JSON.stringify(result));
      })
      .catch(err => {
        console.log(err.message);
      });
    Tuesday, June 2, 2020 3:12 PM

Answers