nmarus / node-ews

A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API.
MIT License
116 stars 52 forks source link

www-authenticate not found on ntlm #142

Open peterlee0127 opened 3 years ago

peterlee0127 commented 3 years ago

Hi

My program sometimes get "www-authenticate not found on response of second request" on the ewsFunction "GetItem" It happens about two times in every 10-20 times. Like get 100 items, I will get 10 error.

Dose anyone have similar issue ?

Thanks

Error: www-authenticate not found on response of second request
    at sendType3Message (/Users/xxxxxxxxxxxx/node_modules/node-ews/node_modules/httpntlm/httpntlm.js:71:20)
    at Immediate.<anonymous> (/Users/xxxxxxxxxxxx/node_modules/node-ews/node_modules/httpntlm/httpntlm.js:102:4)
    at processImmediate (internal/timers.js:462:21)
const ewsConfig = {
  username: config.useraccount,
  password: config.password,
  host: config.host
};
const ews = new EWS(ewsConfig);

function getCalendarItem(Id, callback)  {
    const ewsFunction = 'GetItem';
    const ewsArgs = {
      'ItemShape': {
        'BaseShape': 'AllProperties',
        "BodyType":'Text'
      },
      'ItemIds' : {
         'ItemId':{
            'attributes': {
               'Id': Id
             }
          }
      }
    }

    ews.run(ewsFunction, ewsArgs)
      .then(result => {
        const json = JSON.stringify(result);
        callback(json);
      })
      .catch(err => {
        console.log(err);
        callback(null);
      });
}