PRB: CDO Cannot See New Incoming Messages in Personal Folders
ID: Q195380
|
The information in this article applies to:
-
Collaboration Data Objects (CDO), versions 1.1, 1.2, 1.21
SYMPTOMS
If you designate a Personal Folders store as the delivery location for your
incoming messages, your Collaboration Data Objects (CDO) application fails
to see new incoming messages.
CAUSE
The New mail has not been transferred to the Personal Folders store yet.
CDO 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
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 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.
MORE INFORMATION
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 Library or Active Messaging 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: Put 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.
- 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.
REFERENCES
For more information on setting mail delivery to a Personal Folders file,
please see the following article in the Microsoft Knowledge Base:
Q182062
OL98: Working with Personal Folders
Additional query words:
Keywords : kbActMsg kbCDO110 kbCDO120 kbCDO121 kbMsg
Version : WINDOWS:1.1,1.2,1.21
Platform : WINDOWS
Issue type : kbprb