You receive the error "The attempted operation failed" in Outlook 2010 when you try to retrieve the DisplayType property of an email recipient


Symptoms


Consider the following scenario:
  • You access the Outlook Object Model (OOM). To do this, you use a custom Microsoft Outlook 2010 add-in, a custom script, or other programming language to read the DisplayType property of a Recipient object of an email message that is being replied to.
  • The add-in uses the following object properties to access the recipient's DisplayType:
    Outlook.Recipient.DisplayType
In this scenario, you receive the following error:

Run-time error '-1040973553 (c1f4010f)
The attempted operation failed. An object could not be found.

Cause


This issue occurs because the property PR_RECIPIENT_TYPE is not set when an email message is replied to. Earlier Outlook versions ignore the fact that the property is not set when the property is read. Outlook 2010 does not ignore this property. Therefore, you receive the error message that is mentioned in the "Symptoms" section.

Resolution


To resolve this issue, you have to access the following DisplayType property of the AddressEntry object:
Outlook.Recipient.AddressEntries(index).DisplayType
In this example, the index placeholder refers to a specific AddressEntry or recipient object in the AddressEntries collection.