Long story short: I'm trying to handle meeting forward notifications using EWS 1.2 Java and Exchange 2010 SP2. Forward notifications have no distinct class in the API, but they do have their own Message Class to differentiate them from other email messages. I need to get the email address of the person to whom the notification was forwarded. This address is in the body of the email, but I have no idea if that is templated, subject to change, if the user has any control over it, or if it can change in any way to break any code that tries to parse out the address.
That leaves the PidLidForwardNotificationRecipients property, which is a binary property. This comes through as a byte array. I've checked over the structure of the RecipientRow:
http://msdn.microsoft.com/en-us/library/ee179606%28v=exchg.80%29.aspx
The problem is...how in the heck can I properly decode this thing? I've been able to get it partially legible and can even see the email address I'm trying to grab, but it seems that it uses different encoding for different variable-length fields and everything
around it is gobbledegook. The first two bytes are supposed to be flags that give at least some information on the rest of the data, but only one bit is set out of all of them on my end, which doesn't seem right at all. These can apparently use a variable-length
MBCS character encoding, too, which makes it even more fun.
I need to be able to reliably pick this thing apart and extract that email address from it, but darned if I can find a good way of doing so. Perhaps there are better tools in C#/VB, but Java...perhaps not, or maybe I'm missing something. Why in the blazes couldn't Microsoft just attach the email(s) of the forwarded recipients outright to this thing as a separate property?