Skip to content

Issue with @ewsjs/xhr and ews-javascript-api cann't read property of undefined #436

@MahmoudShaltoot

Description

@MahmoudShaltoot

Hello!
I am trying to initialize calender folder object using ews.CalendarFolder.Bind(exch, ews.WellKnownFolderName.Calendar) but I get this error

TypeError: Cannot read properties of undefined (reading 'headers')
    at NtlmProvider.preCall (D:\TDRA\tra-gate-api\node_modules\@ewsjs\xhr\dist\ntlmProvider.js:48:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async XhrApi.xhr (D:\TDRA\tra-gate-api\node_modules\@ewsjs\xhr\dist\xhrApi.js:123:25

Here is the code

      // create instance
      let xhr = new XhrApi({rejectUnauthorized: false})
        .useNtlmAuthentication(credentials.userName, credentials.password);

      ews.ConfigurationApi.ConfigureXHR(xhr);

      var service = new ews.ExchangeService(ews.ExchangeVersion.Exchange2013);
      service.Credentials = new ews.WebCredentials(credentials.userName, credentials.password);
      service.Url = new ews.Uri(this.app.options['exchangeServiceUrl']);
      service.ImpersonatedUserId = new ews.ImpersonatedUserId(ews.ConnectingIdType.SmtpAddress, email)

      // Initialize the calendar folder object with only the folder ID.
      let calendar = await ews.CalendarFolder.Bind(service, ews.WellKnownFolderName.Calendar);
      ...

This issue occurs with ews.CalendarFolder.Bind(service, ews.WellKnownFolderName.Calendar);

PS: I tried to figure out what is the issue from the package I found that this request returns undefined

link: https://github.com/ewsjs/xhr/blob/a6265b03ba092c3712e27d9d3366bbf7add49ed3/src/ntlmProvider.ts#L54C31-L54C64

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions