A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Header from Outlook Rule



 
 
Thread Tools Search this Thread Display Modes
  #11  
Old May 22nd 06, 07:17 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Header from Outlook Rule

Am Sat, 20 May 2006 17:42:01 -0700 schrieb Steve A.:

If an object variable isn´t set then, of course, trying to access that
object´s methods fails, too.

Because the message header contains e-mail addresses it´s blocked. A good
page that lists all infos about that is www.outlookcode.com/d/sec.htm

For getting the header without that dialog I´d recommend the Redemption from
www.dimastr.com

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Michael thanks for your help.

There was another critical error in the code as well. The inclusion of

error
handling helped flush it out. The other error was a call to

objSession.Logoff

The code that works for me is show below. The only problem now being the
pop-up dialog "A program is trying to access e-mail addresses you have

stored
in outlook. Do you want to allow this?"

Regards Steve A

Code for retrieving internet headers in an Outlook Rule:

Function GetCDOItemFromOL(objOLItem As Object) As MAPI.Message
Dim objSession As MAPI.Session
Dim objApp As Outlook.Application
Dim strEntryID As String
Dim strStoreID As String

On Error GoTo eh

Set objApp = CreateObject("Outlook.Application")
strEntryID = objOLItem.EntryID
strStoreID = objOLItem.Parent.StoreID
Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False

Set GetCDOItemFromOL = objSession.GetMessage(strEntryID, strStoreID)

'objSession.Logoff == WAS AN ERROR
Set objSession = Nothing
Exit Function
eh:
If Err.Number 0 Then
MsgBox "Connection error: " & Err.Number & " " & Err.Description
Err.Clear
Exit Function
End If

End Function

Sub RuleScript(MyMail As MailItem)
Dim objCDOMsg As MAPI.Message
Dim InternetHeaders As String
Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E
Set objCDOMsg = GetCDOItemFromOL(MyMail)
InternetHeaders = objCDOMsg.Fields(CdoPR_TRANSPORT_MESSAGE_HEADERS). Value
MsgBox "Mail message arrived Internet Headers Are : " & InternetHeaders
Set objCDOMsg = Nothing
End Sub

Ads
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mail filter rule based on mail header field volker.badziong Outlook - Installation 4 June 16th 06 11:45 AM
I can't download email only header in Outlook Sandra JI Outlook - General Queries 1 May 5th 06 06:23 PM
printing name header in outlook 2000 emails djeanes Outlook - General Queries 1 February 15th 06 07:57 PM
Configure Outlook attachment icon to display in email header Jean-Claude Outlook - Installation 1 February 6th 06 07:30 AM
How can I change the content of my outlook e mail message header? jggome Outlook - Using Contacts 1 January 26th 06 04:32 AM


All times are GMT +1. The time now is 02:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.