PRB: MAPI_E_NOT_FOUND Err Setting Value of Property with CDO

ID: Q183094

The information in this article applies to:

SYMPTOMS

When attempting to set the value of a field (property) of a Collaboration Data Objects (CDO) 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 (such as

   PR_EXPIRY_LIMIT (&H00150040)):

      objMsg.Fields(&H00150040) = 234

3. Note that the above statement fails with this error:

      MAPI_E_NOT_FOUND.

REFERENCES

For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q176916
   TITLE     : INFO: Active Messaging and Collaboration Data Objects (CDO)

Additional query words: ActMsg
Keywords          : kberrmsg kbCDO110 kbCDO120 kbCDO121 kbGrpMsg 
Version           : WINDOWS:1.1,1.2,1.21
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: April 8, 1999