Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward - Invalid child element 'IsRead' #268

Open
aldent95 opened this issue Oct 17, 2017 · 0 comments
Open

Forward - Invalid child element 'IsRead' #268

aldent95 opened this issue Oct 17, 2017 · 0 comments

Comments

@aldent95
Copy link

I've been working on a Proof of Concept today using this gem and keep on getting the error in the title when trying to forward emails.

Full error
DEBUG Viewpoint::EWS::Connection : Internal SOAP error. Message: The request failed schema validation: The element 'ForwardItem' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types' has invalid child element 'IsRead' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'. List of possible elements expected: 'CcRecipients, BccRecipients, IsReadReceiptRequested, IsDeliveryReceiptRequested, From, ReferenceItemId, NewBodyContent' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'., Code: a:ErrorSchemaValidation

SOAP request being sent as provided by require 'viewpoint/logging/config', removing my email address for obvious reasons.

DEBUG  Viewpoint::EWS::SOAP::ExchangeWebService : Sending SOAP Request:
----------------
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010"/>
  </soap:Header>
  <soap:Body>
    <CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" MessageDisposition="SendAndSaveCopy">
      <Items>
<t:ForwardItem>
  <t:ToRecipients>
    <t:Mailbox>
      <t:EmailAddress>REMOVED</t:EmailAddress>
    </t:Mailbox>
  </t:ToRecipients>
  <t:IsRead/>
  <t:ReferenceItemId Id="AAMkADMzZGNlNjQwLTY2YWUtNDc2NC05YWU5LTVjYmY2NzhiZmY5MwBGAAAAAAC4is8815fvQY+VIAunqvgGBwBWmlaGdmoiQ46HU+QHQjnlAAGLeS9xAABWmlaGdmoiQ46HU+QHQjnlAAGLeTk4AAA=" ChangeKey="CQAAABYAAABWmlaGdmoiQ46HU+QHQjnlAAGLhAka"/>
  <t:NewBodyContent BodyType="Text">This is a test forward</t:NewBodyContent>
</t:ForwardItem>
      </Items>
    </CreateItem>
  </soap:Body>
</soap:Envelope>

----------------

Code I am using to forward

def forward(message)
    message.forward do |m|
      m.new_body_content = 'This is a test forward'
      m.to_recipients << 'REMOVED'
      m.importance = nil
      m.is_read = nil
    end
  end

I did manage to work around the issue by directly modifying the Viewpoint code in the gem folder but obviously this is far from an ideal solution.
To get it to work I changed this
msg[:is_read] = is_read
to this
msg[:is_read] = is_read if is_read != nil
that code is on line 67 of lib/ews/templates/message.rb

I am more than happy to put in a Pull Request if you want, I just can't do it right at this moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant