 |
|
|
How to get the Internet Header
programmatically...
Microsoft Outlook 97, 98, and 2000 do not expose a method or
property that allows a developer to access the Internet Header of a
message. This VBA code snippet developed for Outlook 2000 will
show the inspiring minion how to retreive the data using
Collaboration Data Objects (CDO) 1.21.
| Code |
Function GetInternetHeader(ByVal
oMsg as
MailItem) as
String
Dim objCDO As MAPI.Session
Dim objMsg As MAPI.Message
Dim oFields As MAPI.Fields
Dim oField As MAPI.Field
On Error Resume Next
Set objCDO = CreateObject("MAPI.Session")
objCDO.Logon "", "", False, False
Set objMsg = objCDO.GetMessage(oMsg.EntryID)
Set oFields = objMsg.Fields
GetInternetHeader = oFields.Item(&H7D001E).Value
Set oFields = Nothing
Set objMsg = Nothing
objCDO.Logoff
Set objCDO = Nothing
End Function
|
| |
|
|
Notes
|
In order for this sample to work from Outlook 2000's VBA
environment, you must set a reference (Tools | References)
to Microsoft CDO 1.21 Library.   Microsoft no
longer offers the Collaboration Data Objects 1.21
redistributable. MS KB article Q171440
will help you determine which MS Products have this library
included.
|
Updated
26 Apr 2001
|
|
|
|
 |