martedì 2 luglio 2013

m leggi intestazione internet

Attribute VB_Name = "m_leggi_intestazione_internet"

'

Option Explicit

'

' vba per Outlook

' visualizza intesazioni internet

' di un messaggio di posta elettronica.

' cartelle pubbliche.

' Outlook 2002

'

Sub LeggiIntestazioneInterneteMail()

'

Const PR_SENDER_EMAIL_ADDRESS = &HC1F001E

Const PR_TRANSPORT_MESSAGE_HEADERS = &H7D001E

'

Dim oMsgColl, quantimessaggi, testo

Dim mittente, emailmittente, oggettomsg, intestazionemsg

Dim MAPIobj As MAPI.Session, MAPIfold As MAPI.Folder

Dim oMessage As MAPI.Message

Set MAPIobj = New MAPI.Session

MAPIobj.Logon , , False, False



Set MAPIfold = MAPIobj.InfoStores("Cartelle pubbliche").RootFolder.Folders("Tutte le cartelle pubbliche")

Set MAPIfold = MAPIfold.Folders("Amministrazione")

'

Set oMsgColl = MAPIfold.Messages

quantimessaggi = oMsgColl.Count

'

For Each oMessage In oMsgColl

testo = ""

With oMessage

mittente = .Sender

oggettomsg = .Subject

emailmittente = .Fields(PR_SENDER_EMAIL_ADDRESS)

intestazionemsg = .Fields(PR_TRANSPORT_MESSAGE_HEADERS)

'

testo = testo & "mittente: " & mittente & vbCrLf

testo = testo & "email mittente: " & emailmittente & vbCrLf

testo = testo & "oggetto msg: " & oggettomsg & vbCrLf

testo = testo & "intestazione msg: " & intestazionemsg & vbCrLf

End With

MsgBox testo

Next

'

'

End Sub

'

Nessun commento:

Posta un commento