PRB: Error MAPI_E_NOT_FOUND (8004010F) Using CDO

ID: Q179639

The information in this article applies to:

SYMPTOMS

You may receive the following error message:

   Collaboration Data Objects
   [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

There are several reasons for this error message to appear. This article discusses some of the causes and resolutions for the error.

CAUSE

Following is a list of causes for the error:

1. If your code is running in an Active Server Page (ASP), you may be

   passing a profile name to the Logon method where the profile does not
   exist on the Microsoft Internet Information Server (IIS) computer.

2. You may be trying to use a resource that does not exist. This happens
   when you try to use a server or you try to logon to a mailbox that does
   not exist. A common cause of this is copying and pasting sample code
   without modifying the server and mailbox variables.

3. You may be trying to resolve a recipient that does not exist.

4. When retrieving elements from the folders collection through the

   Folders.Item(searchValue) statement, you may be trying to retrieve a
   previous item.

5. You may be using the GetFreeBusy() method against an Exchange Server
   mailbox that has not been logged into yet, or that does not have any
   appointments in the calendar.

6. While sending mail on Groupwise you may receive this error when
   accessing the Outbox or when calling the "Send" method.

7. You may be attempting to set the value of a field (property) on a
   Collaboration Data Objects (CDO) object where the field (property) does
   not exist.

RESOLUTION

The following resolutions match the causes listed in the CAUSE section.

1. You should use the ProfileInfo parameter on the Logon call instead of a

   specific profile name. This allows you to create a profile
   programmatically for the user of the ASP.

   The reason for this is that the user will not normally have profiles on
   the server machine, and they are probably not going to be loaded into
   HKEY_CURRENT_USER in order to be found by CDO.

2. Check your code for variables that are used in the Logon method of
   Session object. Most ASP sample code contains a variable called
   "strProfileInfo". This is a combination of the server name, a line feed,
   and the mailbox name. Look for the variables that define the server and
   mailbox, and make sure that the resources are on your network and
   Exchange Server.

3. Make sure that the recipient is as specified. If you pass an invalid
   recipient to CDO in an ASP the only way to resolve the problem is to re-
   enter the recipient. You cannot call up the Address Book on the client.

4. When retrieving elements from the folders collection through the
   Folders.Item(searchValue) statement you try to retrieve a previous item.

   The Folders.Item(searchValue) statement performs a forward search. So,
   if you use that statement to retrieve item two (2) of the folders
   collection and then later you try to access a previous item of the same
   collection, you receive the error.

   To work around this problem, use the index parameter of the
   Folders.Item() statement. The Item(index) syntax returns the Folder
   object at the indicated position in the collection.

   Alternatively, you could use the "GetFirst", "GetPrevious", "GetNext",
   and "GetLast" methods of the FoldersCollection object.

5. Free/Busy information will not be available for a mailbox until it has
   been logged onto with a mail client and at least one appointment exists
   in the calendar for the mailbox.

   Here are three workarounds to this problem:

      - Log into the mailbox with an Outlook client to ensure that there is
        some Free/Busy information written to the mailbox. When you log
        into mail for the first time, Outlook creates an appointment item
        that in turn creates Free/Busy information.

      - Log into the mailbox with an Exchange client and start Schedule+ or
        just start Schedule+ by itself. This creates Free/Busy information
        in that mailbox, there is no need to actually create an
        appointment.

      - Use CDO to create a new test appointment so that Free/Busy
        information is created for that mailbox.

6. While sending mail with a Novell GroupWise account, you may receive a
   MAPI_E_NOT_FOUND error while accessing the Outbox or calling the "Send"
   method.

   Use the following to resolve the error:

      - Specify NoMail:=True on the call to the Logon method of the
        Session object.

      - Make sure that the MAPI Spooler is not running already after having
        connected to GroupWise message store (such as with Outlook).

    NOTE: These workarounds can also solve other problems of sending mail
    with CDO on a GroupWise account:

       - Message is sent, but text and attachments do not exist.

       - Message shows up in sent items, but is never delivered to
         recipient

7. 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 preceding code sample demonstrates adding and setting the value for
   the PR_EXPIRY_LIMIT (&H00150040) field. No error occurs if the property
   already exists.

REFERENCES

For information, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q183094
   TITLE     : PRB: MAPI_E_NOT_FOUND Err Setting Value of Property with CDO

   ARTICLE-ID: Q183250
   TITLE     : PRB: CDO Error: Run-time error "-2147221233" with
               GetFreeBusy

   ARTICLE-ID: Q195662
   TITLE     : HOWTO: Log On to Exchange with the ProfileInfo Parameter

Additional query words:
Keywords          : kbcode kbole kbCDO kbCDO110 kbCDO120 kbCDO121 kbMsg 
Version           : WINDOWS:1.2
Platform          : WINDOWS
Issue type        : kbprb
Solution Type     : kbpending

Last Reviewed: January 7, 1999