Hi,
I am working on exchange 2010 (sp1) and using EWS and trying to read mails from journaling mailbox.
Below is the pseudo code:
var MailBox = new Mailbox(SmtpAddress);
FolderId folderId = new FolderId(WellKnownFolderName.Inbox, MailBox);
foreach (Item item in findResults.Items)
{
if (item is EmailMessage)
{
ProcessMessage(item);
}
}
Now in this ProcessMessage function I am copying the item data to my own email class
foreach (Microsoft.Exchange.WebServices.Data.Attachment attachment in item.Attachments)
{
if (itemAttachment.Item is EmailMessage)
{
EmailMessage msg = (EmailMessage)itemAttachment.Item;
// Reading properties
Myemail. Time = msg.DateTimeReceived;
Myemail.subject = msg.Subject;
Myemail.sender = msg.Sender.Address;
Myemail.MessageId = msg.InternetMessageId
}
}
Now here I am getting ServiceObjectPropertyException while reading properties.
Now here I am worried about InternetMessageId property and for few emails I am getting this exception. Offcourse I can read the message id from body of journaling email but I dont want to do that as I have to set flags to check if it is attached email to journaling email or embedded email from original message.
Any idea why InternetMessageId is giving exceptions? I can clearly see message ids for those emails in body of journaling email.
Also some times the other three properties also throw exception.
Regards,
Amit