WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Internet headers Field from Outlook Message


Question:

I'm looking for a way to get the Internet headers Field from an outlook message.

The last thing I've tried (without success...)

olFolderInbox=6 
internetHeadersField = 8192030 ; &H7D001E 

MSapp = Objectopen ("Outlook.Application")
utils = CreateObject("Redemption.MAPIUtils") 
objNameSpace = MSapp.GetNamespace("MAPI")
objFolder = objNameSpace.GetDefaultFolder.(olFolderInbox); 'Access the Inbox
objcount=objFolder.Items
foreach oMessage in objFolder.Items
Id= oMessage.EntryID
sender= oMessage.SenderName 
internetHeaders = utils.HrGetOneProp( oMessage.MAPIOBJECT , internetHeadersField)
next
utils.cleanup
objectclose( utils )
objectclose( objFolder )
objectclose( objNameSpace )
objectclose( MSapp )

exit
Any suggestions?

Question:

Here is my attempt at a translation:

;The code below will browse a collection of mails and displays a message box with the internet headers
;To get the code working
;0) install redemption 
;1) set tools/macros/security to Medium
;2) close OL and restart: accept macros to be fired
;3) Run the code below

myOlApp = CreateObject("Outlook.Application")
;Use this method to return the Explorer object that the user is most likely viewing. 
myExplorer = myOlApp.ActiveExplorer
;Using the Selection Object 
;Use the Selection property to return the Selection collection from the Explorer object. For example:
;mySelectedItems = myExplorer.Selection
mySelection = myExplorer.Selection

utils = CreateObject("Redemption.MAPIUtils")
If mySelection.Count = 0 
mySelection = 0
Exit 
EndIf

foreach itm in mySelection
MailItem = itm
internetHeadersField = 8192030 ;&H7D001E (8192030) or &HC1F001E(203358238)
internetHeaders = utils.HrGetOneProp(MailItem.MAPIOBJECT, internetHeadersField)
Message("internetHeaders", internetHeaders)
MailItem = 0
next

utils = 0
mySelection = 0
myExplorer = 0
myOlApp = 0

Article ID:   W16585
File Created: 2005:02:18:12:21:32
Last Updated: 2005:02:18:12:21:32