Microsoft KB Archive/193451

= PRB: "Error 8002009 - MAPI_E_NOT_INITIALIZED 80040605" with CDO (1.x) =

Article ID: 193451

Article Last Modified on 3/4/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.1
 * Microsoft Collaboration Data Objects 1.2
 * Microsoft Collaboration Data Objects 1.21

-



This article was previously published under Q193451



SYMPTOMS
Running a Collaboration Data Objects (1.1, 1.2, 1.21) application can produce the following error:

Error 8002009 - MAPI_E_NOT_INITALIZED 80040605



CAUSE
This error can be caused by having a CDO (1.1, 1.2, 1.21) action being performed on the session object before the Session.Logon method is executed.

Any of the following methods can cause this error to occur:
 * Session.InfoStores
 * Session.OutOfOffice
 * Session.OutOfOfficeText
 * Session.CurrentUser
 * Session.Name



RESOLUTION
The Logon method must be called before any other CDO (1.1, 1.2, 1.21) actions can be performed with the Session object prior to a successful logon. The only method that can be used before a successful logon is the SetLocaleIDs method of the Session object. In addition, you can access the Version property before a successful logon.



Steps to Reproduce Behavior
 Create a new .asp page or create a Microsoft Visual Basic project.  If you are creating an .asp page, copy and paste the following code into the .asp file:

NOTE: If you are creating a Microsoft Visual Basic project, paste only the statements between <% and %> into the project, and remove the "Server" from the first "Set objSession = " line.     Document Title  <BODY>

<%

CONST strServer                            = <Valid ServerName> CONST strMailbox                           = <Valid MailboxName>

Dim objSession Dim strProfileInfo

strProfileInfo = strServer & vbLf & strMailbox Set objSession = Server.CreateObject("MAPI.Session") Response.Write(objSession.CurrentUser)

objSession.Logon "", "", False, True, 0, True, strProfileInfo Response.Write("Logged into Mailbox as: " & objSession.CurrentUser _          & " ") objSession.Logoff Set objSession = Nothing

%>

</BODY> </HTML> </li> When the script runs, you receive the error message listed in the SYMPTOMS section.</li></ol>

Keywords: kbmsg kbprb kbfaq KB193451

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.