nmarus / node-ews

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

Added support for custom SOAP headers. Fixes #4 #5

Closed ddolcimascolo closed 8 years ago

ddolcimascolo commented 8 years ago

Example query with the new data structure:

ews.run('FindItem', {
  body: {
    attributes: {
      Traversal: 'Shallow'
    },
    ItemShape: {
      BaseShape: 'IdOnly',
      AdditionalProperties: {
        FieldURI: {
          attributes: {
            FieldURI: 'item:Subject'
          }
        }
      }
    },
    CalendarView: {
      attributes: {
        MaxEntriesReturned: 10,
        StartDate: '2016-01-01T00:00:00Z',
        EndDate: '2016-12-31T00:00:00Z'
      }
    },
    ParentFolderIds: {
      DistinguishedFolderId: {
        attributes: {
          Id: 'calendar'
        }
      }
    }
  },
  headers: {
    'http://schemas.microsoft.com/exchange/services/2006/types': [{
      RequestServerVersion: {
        attributes: {
          Version: 'Exchange2010'
        }
      },
      ExchangeImpersonation: {
        ConnectingSID: {
          SmtpAddress: '...'
        }
      }
    }]
  }
}, function(err, result) {});