Efetuar um loop em todos os e-mails disponíveis na sua estrutura do MS Outlook deve ser muito útil em algumas circunstâncias de identificação.
Dim oitem As Outlook.MailItemSub browse_all_emails_in_all_subfolders_of_specific_folder()'Tools Reference Microsoft OutlookDim olapp As Outlook.ApplicationDim olappns As Outlook.NamespaceDim oinbox As Outlook.FolderDim oFolder As Outlook.MAPIFolder'tools->refrence->microsoft outlookSet olapp = New Outlook.ApplicationSet olappns = olapp.GetNamespace("MAPI")Set oinbox = olappns.GetDefaultFolder(olFolderInbox)Set oinbox = oinbox.Folders("Ashish")For Each oitem In oinbox.Items' u can add if condtions to filter the emails etc.' u can add data it to excel sheet or database tableMsgBox "Mail Subject -> " & oitem.SubjectMsgBox "Sender Email Address -> " & oitem.SenderEmailAddressMsgBox "Sender Name -> " & oitem.SenderNameMsgBox "Mail Body -> " & oitem.BodyMsgBox "Recived Date -> " & oitem.ReceivedTimeMsgBox oinbox.NameMsgBox oinbox.FolderPathNextFor Each oFolder In oinbox.FoldersCall subfolders_go(oFolder)NextEnd Sub
Private Sub subfolders_go(oParent As Outlook.Folder)Dim oFolder1 As Outlook.MAPIFolderFor Each oitem In oParent.Items' u can add if condtions to filter the emails etc.' u can add data it to excel sheet or database tableMsgBox "Mail Subject -> " & oitem.SubjectMsgBox "Sender Email Address -> " & oitem.SenderEmailAddressMsgBox "Sender Name -> " & oitem.SenderNameMsgBox "Mail Body -> " & oitem.BodyMsgBox "Recived Date -> " & oitem.ReceivedTimeMsgBox oParent.NameMsgBox oParent.FolderPathNextIf (oParent.Folders.Count > 0) ThenFor Each oFolder1 In oParent.FoldersCall subfolders_go(oFolder1)NextEnd IfEnd Sub
Nenhum comentário:
Postar um comentário