1
votes

I have Outlook mail Entry ID, I want Details of that Entry Id that's To, Subject ,Body Ect..

Emails are still in inbox not moved anywhere

I write code in VBA

Thanks in advance..

Private Sub CommandButton4_Click()
i = 0
j = 1

Dim path, FileName As String Set currentExplorer = Application.ActiveExplorer Set Selection = currentExplorer.Selection

        Set currentMail = objNameSpace.GetItemFromID("000000000AB85207D8C3664BA439B3CE1603D186070019BED8705003484BACA686B84F9C6E880000006DE67E000019BED8705003484BACA686B84F9C6E880000428CEF9B0000")
                MailTo = currentMail.To
                MailSubject = currentMail.Subject
                MailBody = currentMail.Body
                MailDateTime = currentMail.CreationTime
                attcount = currentItem.Attachments.Count

        For j = 1 To attcount + 1


            'FileName = "\\wipfs01\ES Quality\Personal Folders\Mahesh\Tools\Sorting-Telus\Attachment\" & Atmt.FileName
            'Atmt.SaveAsFile FileName

            Set chk = UserForm2.Controls("chkn" & j)

            If chk.Value = True Then

                path = SaveAttachment("\\wipfs01\ES Quality\Personal Folders\Mahesh\Tools\Sorting-Telus\Attachment\PO\")
                FileName = path & currentItem.Attachments(j).FileName
                currentItem.Attachments(j).SaveAsFile FileName

                Set currentMail = currentItem
                MailTo = currentMail.To
                MailSubject = currentMail.Subject
                MailBody = currentMail.Body
                MailDateTime = currentMail.CreationTime
                chk.Visible = False
            End If


         Next j

    'MsgBox MailTo & vbCrLf & MailSubject & vbCrLf & MailBody & vbCrLf & MailDateTime

End Sub

1
You should post some of the code. What you have tried to solve this problem.MikroDel
Ohter way the question may be closed or not answeredMikroDel
@MikroDel i have add codeMahesh219
Very very good! Now its good questionMikroDel

1 Answers

0
votes

Use Namespace.GetItemFromID to open the message using its entry id.