Why does Exchange Web Services return ErrorInvalidIdMalformed Error on GetMailMessage

+1 vote
asked Oct 7, 2015 by TheRealPopeye (740 points)
edited Oct 7, 2015 by Tomas Knopp

I am getting an error when trying to retrieve an Email using Exchange Web Services.
I am getting a list of emails available with this;

var messageInfoList = mailBoxMonitor.ExchangeWS.GetMessageList(new     EwsFolderId(mailBoxMonitor.MailBoxSettings.Folder), EwsListFields.All, offset, chunkSize);

Then iterating through that list to retrieve each email with;

foreach (EwsMessageInfo thisMessageInfo in messageInfoList)
    MailMessage thisMessage = mailBoxMonitor.ExchangeWS.GetMailMessage(thisMessageInfo.ItemId);

But the GetMailMessage call is returning ErrorInvalidIdMalformed even though I'm simply passing on the ItemId returned from the list. It doesn't always do this, only for certain emails.

What am I doing wrong?

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Oct 7, 2015 by Pavel Matyska (15,060 points)
edited Jan 13, 2016 by Tomas Knopp

This bug has been fixed in the 2016 R1 version of Rebex Secure Mail that now officially supports Exchange Web Services on top of IMAP, POP3 and SMTP. See our blogpost for more details.

Hello, from the pieces of the code I would say that everything should work just fine. Please, create a log with LogLevel.Debug and send it back to us at support@rebex.net to analysis. You can set mailBoxMonitor.ExchangeWs.LogWriter property just before the GetMessageList call. It should contain plan SOAP requests and responses.
Without the log I can only say that some ID your Exchange server did not recognize as valid ID, so there is a possibility that we somehow destroyed the received ID. But to be sure we still need the log.

commented Oct 8, 2015 by Pavel Matyska (15,060 points)
edited Jan 13, 2016 by Lukas Pokorny
The issue was resolved with newer beta build.
commented Jan 15, 2016 by Pavel Matyska (15,060 points)
The beta was released as 2016 R1 version of Rebex Secure Mail.