0

I am currently working on a script fetching subjects and attachements from an email received with Exchange.

For this purpose, I have found php-ews and used one of the provided examples to retrieve the attachments. The script throws ErrorInvalidIdMalformed: Id is malformed when I try running it.

I would have guessed I made a mistake getting the MessageID from Outlook, but it seems that there is only one field labeled "MessageID". It looks like this: 3cbab9c9ad50410592b55f7ade96a57a@[domain].fr

Is there anything I have missed ?

Thanks for helping.

ilomax
  • 568
  • 1
  • 4
  • 24

2 Answers2

0

ErrorInvalidIdMalformed

means that there is structural issues with the MessageID string that is being passed in. However, there doesn't seem to be any problems with the MessageID you posted.

You could try serializing the GetItemRequest instance via an XmlSerializer and then examine the actual xml for issues. (maybe post the actual xml to your question).

I would guess that there is a character missing from your xml or else it contains something it shouldn't.

MadDev
  • 1,130
  • 1
  • 13
  • 29
0

It looks like your confusing the EWSId with the MessageId, the EWSid is the identifier that can be used to access an Item directly see https://msdn.microsoft.com/en-us/library/office/dn605828%28v=exchg.150%29.aspx for a full discussion.

The messageId 3cbab9c9ad50410592b55f7ade96a57a@[domain].fr in your instance is the Internet MessageID which is assigned generally by the first MTA to process the Message. You can search for a Message with this ID using EWS and the FindItem operation eg Exchange Web Service find EmailMessage by "Message-ID" header but you can't use that ID to bind to the item directly. (if you do just want an ewsId you can bind to directly use the EWSEditor https://ewseditor.codeplex.com/ to get a bindable example)

Glen Scales
  • 20,495
  • 1
  • 20
  • 23