none
vba code/macro to get replied date and time of an email in outlook 2010 RRS feed

  • Question

  • Hi,

    I certainly read through all the related posts but as I am new to VBA I couldn't get a straight forward answer, so writing this post. I am trying to generate a report which includes an email subject, sender, recieved date & time, replied date & time and finally the time taken to reply each email from my outlook 2010 inbox. I read one post related to this and the answer of "Dmitry Streblechenko _MVP_" but couldn't figure out myself how to use it in the coding, please help, thanks.

    Tuesday, August 26, 2014 9:04 PM

Answers

All replies

  • What answer are you talking about?

    Anyway, you can use the PropertyAccessor class (see the corresponding property of the MailItem class) to get the required info:

    You need to get the property PR_LAST_VERB_EXECUTION_TIME, which has the PropTag
    0x10820040, or in DASL: http://schemas.microsoft.com/mapi/proptag/0x10820040

    Tuesday, August 26, 2014 9:58 PM
  • thanks for the reply.

    answer as in replies to a question

    As I am new to vba, I don't understand the aforesaid solution, can you please post some vba code; which I can try and understand to get the date/time information? thanks

    Thursday, August 28, 2014 11:25 AM
  • The PropertyAccessor class provides the GetProperty method which you can use to get the value:

    Sub DemoPropertyAccessorGetProperty()  
     Dim PropName, Header As String  
     Dim oMail As Object  
     Dim oPA As Outlook.PropertyAccessor  
     'Get first item in the inbox  
     Set oMail = _  
     Application.Session.GetDefaultFolder(olFolderInbox).Items(1)  
     'PR_TRANSPORT_MESSAGE_HEADERS  
     PropName = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"  
     'Obtain an instance of PropertyAccessor class  
     Set oPA = oMail.PropertyAccessor  
     'Call GetProperty  
     Header = oPA.GetProperty(PropName)  
     Debug.Print (Header)  
    End Sub

    Thursday, August 28, 2014 11:48 AM
  • Dear Eugene, the code of yours works like a charm, but It will not give the info about - mail is replied or not, niether the replied time. Any suggestion?

    Details I get when I run your code:

    Received: from * deleted*  with mapi id
     * deleted*; Thu, 14 Aug 2014 20:06:05 +0530
    Content-Type: application/ms-tnef; name="winmail.dat"
    Content-Transfer-Encoding: binary
    From: * deleted* <* deleted* .com>
    To: * deleted* <* deleted* com>, * deleted* <* deleted* .com>
    CC: * deleted* <* deleted* .com>
    Subject: FW: FW: * deleted*
    Thread-Topic: FW: * deleted*
    Thread-Index: AQHPt7d8gLOJuorKRUGPJzGzY/SZ2ZvQBePAgAAc9AiAAAdoMA==
    Date: Thu, 14 Aug 2014 20:06:04 +0530
    Message-ID: <* deleted*>
    References: <* deleted*>
     <* deleted*>
     <* deleted*>
     <* deleted*>
    In-Reply-To: <* deleted*>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Has-Attach: yes
    X-MS-Exchange-Organization-SCL: -1
    X-MS-TNEF-Correlator: <* deleted*>
    MIME-Version: 1.0
    X-MS-Exchange-Organization-AuthSource: * deleted*
    X-MS-Exchange-Organization-AuthAs: Internal
    X-MS-Exchange-Organization-AuthMechanism: 04
    X-Originating-IP: [* deleted*]
    X-MS-Exchange-Organization-AVStamp-Mailbox: * deleted*;1;0;0 0 0

    Sunday, August 31, 2014 7:59 AM
  • As I already wrote above, you need to get the property PR_LAST_VERB_EXECUTION_TIME, which has the property tag
    0x10820040, DASL: http://schemas.microsoft.com/mapi/proptag/0x10820040 .

    • Marked as answer by iamabegginer Sunday, August 31, 2014 6:46 PM
    Sunday, August 31, 2014 10:58 AM
  • got it thanks! now working... awesome
    Sunday, August 31, 2014 6:45 PM