how to create a event in VB.NET for outlook 2003

D

Dinesh

hello everybody,

Iam using a Visual studio 2005 with VSTO for outlook addin 2003.I need a
write this internet header reading to get fired when i click a mail in the
inbox.
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String) Handles
Application.NewMailEx
Dim objOutlook As Outlook.Application
Dim objItem As Outlook.MailItem
Dim objCDO As MAPI.Session
Dim objMessage As MAPI.Message
Dim objFields As MAPI.Fields
Dim strID As String
Dim CdoPR_TRANSPORT_MESSAGE_HEADERS As String = "&H7D001E"
'Const CdoPR_TRANSPORT_MESSAGE_HEADERS As String = "&H7D001E"
On Error Resume Next

' Instantiate an Outlook Application object.
objOutlook = CreateObject("Outlook.Application")

'Find the current email item and get its EntryID
objItem = objOutlook.ActiveInspector.CurrentItem
strID = objItem.EntryID
MsgBox(EntryIDCollection)

'Then set up a CDO Session using a piggy-back login
objCDO = CreateObject("MAPI.Session")
objCDO.Logon("", "", False, False)

'Now get the item as a CDO Message
objMessage = objCDO.GetMessage(EntryIDCollection)

'Now get the headers from the message
objFields = objMessage.Fields
Dim InternetHeaders As String
Dim count As Integer
count = objFields.Count
MsgBox(count.ToString)
'InternetHeaders = "&H7D001E".ToString
InternetHeaders = objFields.Item(&H7D001E).value
'Now that the headers are captured in a string you can do whatever
you want with them

MessageBox.Show(InternetHeaders, "testing", MessageBoxButtons.OK,
MessageBoxIcon.Information, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign, False)

objCDO.Logoff()

objFields = Nothing
objMessage = Nothing
objCDO = Nothing
objItem = Nothing
objOutlook = Nothing

Actually Now iam getting the header of a recent mail when i click the
send/receive button in outlook with the entryidcollection.i can use the
selectedindex of the mail in the inbox but where should i write this because
there only is five main events available
startup,shutdown,itemsend,newmail,newmailex. is it possible to write a our
own event and make this internetheader to read when the email in the inbox is
selected. if so could you please help to write a new event.

Thank you.
 
K

Ken Slovak - [MVP - Outlook]

Answered in your previous post thread. Please do not post the same question
in multiple threads.
 

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