none
Exporting date to the CSV file from Outlook 2013 RRS feed

  • Question

  • I am trying to export few fields from the Outlook 2013 to CSV file.

    Importantly, I am trying to export the date, subject and from/to.

    I am able to find subject & from/to fields in the export option.

    But I am unable to find date field. How can date be exported along with subject and from/to?

    Is this supported in the MS Office 2013?

    Wednesday, July 1, 2015 3:24 PM

Answers

  • Hi,

    The date field is supported in MS Office 2013. you may check the properties for MailItem in Outlook 2013. The following code could export some fields for the mailItem.

    MailItem propertites :https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem_properties.aspx

    Sub CreateCVSFile()
    Dim olApp As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Dim olFolder As Outlook.MAPIFolder
    
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    Set olFolder = objNS.GetDefaultFolder(olFolderInbox)
    Set olFolder = olFolder.Folders("TestFolder")
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set file = fs.CreateTextFile("D:\MailItems.csv", True)
    file.WriteLine "Subject, ItemForm ,Item Received Time"
    For Each msg In olFolder.Items
    file.WriteLine (msg.Subject & " ," & msg.SenderName & "," & msg.ReceivedTime)
    Next
    file.Close
    
    End Sub

    Hope this could help you.

    Best Regards,

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Thursday, July 2, 2015 7:12 AM
    Moderator

All replies

  • Hello Rathin,

    The MailItem class provides the ReceivedTime property which returns a Date indicating the date and time at which the item was received. See Getting Started with VBA in Outlook 2010.

    Wednesday, July 1, 2015 4:04 PM
  • Hi,

    The date field is supported in MS Office 2013. you may check the properties for MailItem in Outlook 2013. The following code could export some fields for the mailItem.

    MailItem propertites :https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem_properties.aspx

    Sub CreateCVSFile()
    Dim olApp As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Dim olFolder As Outlook.MAPIFolder
    
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    Set olFolder = objNS.GetDefaultFolder(olFolderInbox)
    Set olFolder = olFolder.Folders("TestFolder")
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set file = fs.CreateTextFile("D:\MailItems.csv", True)
    file.WriteLine "Subject, ItemForm ,Item Received Time"
    For Each msg In olFolder.Items
    file.WriteLine (msg.Subject & " ," & msg.SenderName & "," & msg.ReceivedTime)
    Next
    file.Close
    
    End Sub

    Hope this could help you.

    Best Regards,

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Thursday, July 2, 2015 7:12 AM
    Moderator