locked
item.HasAttachments returns true but item.Attachments is empty RRS feed

  • Question

  • Hello,

    I've created a few mailboxes with some test email messages in them that contain attachments. I am able to retrieve these messages and all the data seems to add up (message size, text, subject, etc) but although item.HasAttachments return true (which really is the case), item.Attachments is always empty. Am I missing something here?

    I am running Exchange 2010 on Windows Server Datacenter.

    The issue occurs when using the exchange API in my C# app. When I open up the actual test mailbox in OWA all the attachments are there. I have no firewalls or antivirus programs. I am able to see the attachment icon, I can find and download the attachments so I know they really are in the emails. 

    The problem is that when I retrieve all the items from a particular folder in the mailbox using the folder.FindItems(new ItemView(10000)) call, I go through each item individually but the item.Attachments is always empty (not null but just empty) regardless of whether item.HasAttachments is true or false.

    Here's a test log statement that I added to my code:

    Log("Item subject: " + item.Subject + " | Has Attachment: " + item.HasAttachments + " | item.Attachments: " + (item.Attachments == null ? "null" : "not null but count is " + item.Attachments.Count));

    where item is an instance of "Item" and folder is an instance of "Folder".

    Here are a couple of results from a few messages in the inbox folder:

     

     

    [7/12/2010 6:46:03 PM] [11800] [Information] Item subject: testtest | Has Attachment: False | item.Attachments: not null but count is 0

    [7/12/2010 6:46:03 PM] [11800] [Information] Item subject: sdfsfsfs | Has Attachment: True | item.Attachments: not null but count is 0

    [7/12/2010 6:46:03 PM] [11800] [Information] Item subject: | Has Attachment: True | item.Attachments: not null but count is 0

    Your help would be appreciated.

     

    Best, 

    R

    Tuesday, July 13, 2010 2:29 PM

Answers

All replies