Ms Outlook Error -2147221233- [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010

Joined
May 14, 2008
Messages
1
Reaction score
0
I'm running a macro in Ms Outlook to extract attachments from emails and save it in a folder. The sender email address and subject forms the saved attachments' filename.

The macro works fine but recently when I ran it, it gives me this error:
-2147221233- [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]
I have no idea what I did wrong. Not sure if the settings in Outlook I accidentally modified. I did not modify the macro all this while so I'm baffled.

I remember applying a security patch on my pc and I have not the slightest idea what it was. What could have possibly changed in my environment that triggered this error?

Or perhaps is there anything I can do to modify the code below to make it working again?
Code:
Private Function GetExchangeSenderAddress(objMsg As MailItem) As String
  
	Dim oSession As Object
	Set oSession = CreateObject("MAPI.Session")
	oSession.Logon "", "", False, False
	
	Dim sEntryID As String
	Dim sStoreID As String
	Dim oCdoMsg As Object
	Dim sAddress As String
	Const g_PR_SMTP_ADDRESS_A = &H39FE001F
	
	sEntryID = objMsg.EntryID
	sStoreID = objMsg.Parent.StoreID
	Set oCdoMsg = oSession.GetMessage(sEntryID, sStoreID)
	
	sAddress = oCdoMsg.Sender.Fields(g_PR_SMTP_ADDRESS_A).Value
	Set oCdoMsg = Nothing
	oSession.Logoff
	Set oSession = Nothing
	
	GetExchangeSenderAddress = sAddress
	
End Function

Please advice, thanks
 

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