Microsoft KB Archive/195380

= PRB: CDO (1.x) Cannot See New Incoming Messages in Personal Folders =

Article ID: 195380

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 Q195380



SYMPTOMS
If you designate a Personal Folders store as the delivery location for your incoming messages, your Collaboration Data Objects (1.1, 1.2, 1.21) application fails to see new incoming messages.



CAUSE
The new mail has not been transferred to the Personal Folders store yet. CDO (1.1, 1.2, 1.21) does not register for server notifications, therefore, delivery of the new messages to the Personal Folders store does not occur automatically.



RESOLUTION
Following are two alternatives:
 * Run Microsoft Outlook before processing the new messages in your CDO (1.1, 1.2, 1.21) code. The server advises Microsoft Outlook when new mail arrives, which results in the transfer of new messages to the Personal Folders store.

-or-
 * Use the DeliverNow method of the CDO (1.1, 1.2, 1.21) Session object before referring to any message item in your Inbox. The DeliverNow method requests the Messaging Application Programming Interface (MAPI) Spooler to deliver all messages in the inbound queues immediately.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Set mail delivery to a Personal Folders file. For more information on how to accomplish this task, please refer to the article listed in the REFERENCES section. Start a New Project in Microsoft Visual Basic. Make a reference to the Microsoft CDO (1.1, 1.2, 1.21) Library.  Add the following code to the Sub Form_Load event procedure: Dim objSession As MAPI.Session Dim objMsgColl As Messages Dim objMsg As Message Dim objInbox As Folder 'Create the Session then Logon. Set objSession = CreateObject("MAPI.Session") objSession.Logon "YourProfileName" 'TO DO: Enter a valid profilename Set objInbox = objSession.Inbox

'Note: DeliverNow should be called after accessing the store, '     otherwise it will have no effect. ' objSession.DeliverNow

Set objMsgColl = objInbox.Messages For Each objMsg In objMsgColl MsgBox "Subject: " & objMsg.Subject Next Set objMsg = Nothing Set objMsgColl = Nothing Set objInbox = Nothing objSession.Logoff Set objSession = Nothing  Make sure that Microsoft Outlook is not running on your computer. Have somebody send a message to you. Run the preceding program by pressing the F5 key. Confirm that the program did not display the subject of the new message.</li> Either uncomment the line "objSession.DeliverNow" or run Microsoft Outlook and logging into the same profile that you have in the code. Run the program. Confirm that you see the subject of the new message.</li></ol>

<div class="references_section">