Trovata la soluzione, ecco sotto lesempio, tocca solo adattarla a piacimento, ma già funge.
codice:
Private Sub getOutlookEmailInfo() Dim output As String = String.Empty
Dim olApp As Outlook.Application = Nothing
Dim olNameSpace As Outlook.NameSpace = Nothing
'create new instance of Outlook.Application
olApp = New Outlook.Application()
'set olNameSpace to MAPI namespace
olNameSpace = olApp.GetNamespace("MAPI")
' TODO: Replace the "YourValidProfile"
' and "myPassword" with Missing.Value
' if you want to log on with the default profile.
' olNameSpace.Logon("YourValidProfile", "myPassword", True, True)
' olNameSpace.Logon()
'loop through stores
For Each oStore As Outlook.Store In olNameSpace.Stores
'root folder for store
Dim rootFolder As Outlook.MAPIFolder = oStore.GetRootFolder()
'folders for store
Dim subFolders As Outlook.Folders = rootFolder.Folders
'loop through all folders
For Each oFolder As Outlook.Folder In subFolders
'get folder items
Dim oItems As Outlook.Items = oFolder.Items
'search through each email
For Each email As Object In oItems
'make sure item is a mail item,
'not a meeting request
If email.MessageClass = "IPM.Note" Then
If TypeOf email Is Microsoft.Office.Interop.Outlook.MailItem Then
output += "oStore: " + oStore.DisplayName + " oFolder: " + oFolder.Name + " " + "subject: " & email.Subject & System.Environment.NewLine
End If
End If
Next
Next
Next
'olNameSpace.Logoff()
olNameSpace = Nothing
olApp = Nothing
MessageBox.Show(output)
End Sub