Internet Mail Only [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]

S

steve

Hello, I get an error with this code:

Private Sub Command1_Click()
MAIN
End Sub

Sub MAIN()
Dim CDO_Ses
Dim fld
Dim msg
Dim a

Set CDO_Ses = CreateObject("Mapi.Session")
CDO_Ses.LOGON "", "", False, True, 0, True
Set fld = CDO_Ses.getDefaultFolder(1)
For Each msg In fld.messages
Set a = msg.sender
Debug.Print a.address
Next

End Sub

I am only using Outlook 2000 to get my internet mail from my ISP. It
gets a few of the addresses from the message senders in my inbox then it
exits the sub and crashes VB. It also fails when I tried it in VB
Script. Is this a bug with CDO or is it 'not supported"? Any ideas on
ways to work around this problem? I am trying to get the email address
information from my inbox.

Thanks, any help appreciated as I am new to CDO.

Steve

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
S

Sue Mosher [MVP]

CDO is officially unsupported with IMO mode. Try starting Outlook first and
using this logon statement:

CDO_Ses.LOGON "", "", False, False
 
S

steve

Thanks, I appreciate your reply. I tried it but it still crashed. Funny
thing when it crashes it takes down VB6 with it every time.

I discoverd a work around using the Outlook application model. This at
least gives me the email address which I was looking for. I was just
hoping to find a way to use CDO to do the same thing without problems.
In this case I set a reference to the Outlook object library. Here is
what I came up with for anyone else with similar problems:

Sub main()
Dim oapp As Outlook.Application
Dim msg As Outlook.MailItem
Dim oRec As Outlook.Recipient
Dim oRecs As Outlook.Recipients

Set oapp = CreateObject("Outlook.Application")
oapp.GetNamespace ("Mapi")

For Each msg In
oapp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox).Items
MsgBox msg.Reply.Recipients.Item(1).Address
Next

End Sub

Steve

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top