Trying to get sender address with CDO, but got [MAPI_E_NOT_FOUND(8004010F)] error

  • Thread starter Thread starter nycboy
  • Start date Start date
N

nycboy

I use following code with CDO 1.21 reference

Dim objCDOMsg As MAPI.Message
Dim SenderAddress As String

...
' Get Sender's Address
SenderAddress= objCDOMsg.Sender.Address
...

But I got error message:
[Collaboration Data Objects – [MAPI_E_NOT_FOUND(8004010F)]]

Want does it mean and how can I correct it?

Thanks in advance!
 
How are you instantiating objCDOMsg? In other words, what code are you using
to look at a particular message?
 
Here is my (VBA) code:


Dim objOL As Outlook.Application
Dim objMsg As Object
Dim objSelection As Outlook.Selection
Dim objMail As Outlook.MailItem

...

' Instantiate an Outlook Application object.
Set objOL = CreateObject("Outlook.Application")
Set objSelection = objOL.ActiveExplorer.Selection
...

For Each objMsg In objSelection

Set objMail = objMsg
textMsg = GetCDOMsgInfo.GetSenderName(objMail)
...


Function GetSenderName(objMsg As Outlook.MailItem) As String

On Error GoTo GetSenderName_Err

Dim objCDOMsg As MAPI.Message
Dim objSession As MAPI.Session
Dim strEntryID As String
Dim strStoreID As String

Set objSession = CreateObject("MAPI.Session")
'Logon to existing session.
objSession.Logon "", "", False, False
' Get message Information
strEntryID = objMsg.EntryID
strStoreID = objMsg.Parent.StoreID
' Get the message
Set objCDOMsg = objSession.GetMessage(strEntryID, strStoreID)
' Extract the Sender's Address and Return value
GetSenderID = objCDOMsg.Sender.Address
...


Thanks!
 
Why are you setting objMail = objMsg? You'll get an error if the user
selects a meeting request response, for example, by mistake.

I'd step through the code and check to see whether GetMessage is returning a
valid object or Nothing.

Also note that the GetSenderName() function never sets the value of
GetSenderName. It sets GetSenderID instead.

Also note: The newsgroup interface you are using apparently does not quote
earlier messages in the thread. Please take the time to quote the original
message.
 
The real code has message type checking.

Everything is fine until statment:

GetSenderName = objCDOMsg.Sender.Address

(You're right, GetSenderID should be GetSenderName)

objCDOMsg seems a valid one. Because I can get
other properties with no problem, except for

Conversation
ConversationIndex
ConversationTopic
Sender
Sensitivity
TimeExpired

Someone told me Microsoft disabled them for
security reasons (for some CDO version?).
 
Any property related to addresses is a blocked property, but it should give
you a security prompt, not an error message. Does Sender by itself return a
valid AddressEntry object?

Please note: The newsgroup interface you are using apparently does not quote
earlier messages in the thread, making your latest message so short on
detail that you risk not getting the answer you're looking for. Please take
the time to quote the original message.
 
Back
Top