6
votes

I have a problem with loading MimeContent property using EWS with Exchange Server 2013. Here's what I do:

var propertySet = new PropertySet{
            ItemSchema.Subject,
            ItemSchema.TextBody,
            ItemSchema.DateTimeCreated,
            ItemSchema.LastModifiedTime
        };

var item = Item.Bind(mailbox.ExchangeServiceInstance, itemId, propertySet);

Mailbox, permissions, PullSubscription & ExchangeService are setup and working, 'itemId' is the correct, existing one. This code works and I'm able to access the loaded properties.

But when I try to load MimeContent right after it, I get an error:

var binaries = new PropertySet(BasePropertySet.IdOnly, ItemSchema.MimeContent);
item.Load(binaries);

The exception I get is:

'Microsoft.Exchange.WebServices.Data.ServiceResponseException' occurred in Microsoft.Exchange.WebServices.dll

A referenced period is missing.

I couldn't google-find any similar issues with this exception related to EWS, or any similar problems with loading MimeContent. I keep trying to figure it out myself, but can anyone give me a hint where to dig?

1
What happens if you include ItemSchema.MimeContent in the original property set (the one you use when you bind)?Yacoub Massad
@YacoubMassad Same thing, unfortunately.Natu Nuarat

1 Answers

8
votes

Found it! The problem was in the TimeZone settings. They say it's a rare problem, which depends on where and how your Exchange Server is installed.

I only added TimeZoneInfo.Utc in ExchangeService's constructor, and everything works now.

var service = new ExchangeService(ExchangeVersion.Exchange2013_SP1, TimeZoneInfo.Utc)

Hope it might help someone else.