Link to home
Start Free TrialLog in
Avatar of itmti
itmti

asked on

Exporting Outlook emails with messageID to CSV

Any way to export Outlook emails to CSV with message IDs?

3rd Party software suggestions or anything

Thank you,
Avatar of itmti
itmti

ASKER

Need to export Sent Items with MessageIDs to csv.


We exported via Exhange, we just need to correlate and figure out if all the emails that left outlook actually hit Exchange.
Avatar of Amit
For that you check Exchange tracking logs.
Avatar of itmti

ASKER

We did check exchange tracking logs and exported,   I am asking specifically for Outlook export of emails with messageID from header.

Thanks
I don't see any such option to export it. You need to open header info for each message and copy it.
I have never tried this but apparently  you can do this with the Exchange Web Service API. See the link before for reference.
https://social.technet.microsoft.com/forums/windowsserver/en-US/2b116f1b-30b7-4d14-8d5e-e4832920ad2d/export-email-header-information-via-powershell

Will.
@itmti, are you familiar with VBA coding in Outlook?
This is a sample function to get the messageID of messages in the Outlook Inbox.  If this is what you're looking for it will be relatively simple to expand it to send output to a CSV file.
OM Gang

Public Function CopyItem()
On Error GoTo Err_CopyItem

    Dim olNS As NameSpace
    Dim olFolder As MAPIFolder
    Dim olMsg As MailItem
    Dim olPropertyAccessor As Outlook.PropertyAccessor
    Dim intCount As Integer
    
    intCount = 0
    
    Set olNS = Outlook.GetNamespace("MAPI")
    'Set olFolder = olNS.PickFolder   'we can use this to present the user with a dialogue box to select the folder they want to process
    Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
    
    For Each olMsg In olFolder.Items
        If intCount = 10 Then Exit For
        Debug.Print olMsg.Subject
        Debug.Print olMsg.ItemProperties.Class
        Set olPropertyAccessor = olMsg.PropertyAccessor
        Debug.Print "PR_INTERNET_MESSAGE_ID", olPropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1035001E")
            
        intCount = intCount + 1
    Next

Exit_CopyItem:
    Set olPropertyAccessor = Nothing
    Set olDestFolder = Nothing
    Set olMsg = Nothing
    Set olFolder = Nothing
    Set olNS = Nothing
    Exit Function
    
Err_CopyItem:
    MsgBox Err.Number & ", " & Err.Description, , "Error"
    Resume Exit_CopyItem
    
End Function

Open in new window

Avatar of itmti

ASKER

@omgang  -  very limited, but thats what everything pointing me to.

Any suggestion on your code how to export, I ran this in VBA on Outlook but no output or anything.

Thank you
To see the output you need to open/view the Immediate Window in the Outlook VBE.  See the View menu in the VBE or key in Ctrl+G in the VBE to display it.

I'll work on adding code to output to CSV.
OM Gang
Avatar of itmti

ASKER

Ok, so far going well, able to see in the Immediate view.

Would be great for any help with export to CSV
Avatar of itmti

ASKER

@omgang,  

your script exported what we need, just missing date of email and email was sent to.
Could you please suggestion or adjust the code to add that?

Thank you in advance
!
Avatar of itmti

ASKER

@omgang

Please ignore no need for date, but message-id looks good.

Having some issues with picking specific folder, if my folder named expample:  Test
I want everything from that Test folder exported to that Immediate view that would work, i would just clean it up in Excel.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of omgang
omgang
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itmti

ASKER

Thank you!!!