PRB: CDO (1.x) Error MAPI_E_NOT_FOUND Setting Value of Property (183094)



The information in this article applies to:

  • Collaboration Data Objects (CDO) 1.1
  • Collaboration Data Objects (CDO) 1.2
  • Collaboration Data Objects (CDO) 1.21

This article was previously published under Q183094

SYMPTOMS

When attempting to set the value of a field (property) of a Collaboration Data Objects (1.1, 1.2, 1.21) object, the following error may occur:
MAPI_E_NOT_FOUND.

CAUSE

The field probably does not yet exist in the underlying Messaging Application Programming Interface (MAPI) object.

RESOLUTION

Instead of just setting the field value, proceed from the assumption that the field does not exist. Use the Add method of the Fields collection, which facilitates both adding the field and setting the value as follows:
   objMsg.Fields.Add &H00150040, 234
				
The sample above demonstrates adding and setting the value for the PR_EXPIRY_LIMIT (&H00150040) field. No error occurs if the property already exists.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a message object called objMsg.
  2. Try to set a property not directly exposed by CDO (1.1, 1.2, 1.21) (such as PR_EXPIRY_LIMIT (&H00150040)):
          objMsg.Fields(&H00150040) = 234
    					
  3. Note that the above statement fails with this error:
    MAPI_E_NOT_FOUND.

Modification Type:MajorLast Reviewed:6/6/2005
Keywords:kberrmsg kbMsg kbprb KB183094