nmarus / node-ews

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

The required attribute 'Id' is missing. #121

Closed Tiago-Altus closed 4 years ago

Tiago-Altus commented 4 years ago

I'm getting the following error: "a:ErrorSchemaValidation: The request failed schema validation: The required attribute 'Id' is missing."

This is what I have tried:

let Id = 1234;
  const ewsFunction = 'GetAttachment';
  const ewsArgs = {
    'AttachmentIds': {
      'AttachmentId': Id
    }
  }

I am trying to replicate the following soap call:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <GetAttachment xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <AttachmentShape/>
      <AttachmentIds>
        <t:AttachmentId Id="AAAtAEFkbWluaX..."/>
      </AttachmentIds>
    </GetAttachment>
  </soap:Body>
</soap:Envelope>

What am I missing here?

Thanks

Tiago-Altus commented 4 years ago

Solved:

const ewsFunction = 'GetAttachment';
  const ewsArgs = {
    'AttachmentIds': {
      'AttachmentId': {
        'attributes':{
          'Id': '1234'
        }
      }
    }
  }