woggles
woggles

Reputation: 7444

Exchange Web Services attachments collection is empty

Has anyone had an issue with EWS (Exchange 2010 SP1) where the email attachments collection is empty?

The email has 5 attachments (some .tif and some .pdf). My code looks something like like:

if (email is EmailMessage && email.HasAttachments)
{
    foreach (Attachment attachment in email.Attachments)
    {...

enter image description here

Is there something obvious that I'm missing?

Upvotes: 2

Views: 1017

Answers (1)

woggles
woggles

Reputation: 7444

There was something obvious: apparently I need to bind the message before I can access the attachments.

  EmailMessage message = EmailMessage.Bind(service, email.Id, new PropertySet(BasePropertySet.FirstClassProperties, EmailMessageSchema.Attachments));

Upvotes: 6

Related Questions