none
how to know outlook mail replied time in C#? RRS feed

  • Question

  • Hi All,

    I know how to get the outlook mail ReceivedTime in c# (MailItem.ReceivedTime)

    Can any one help me on how to get the mail replied time in c#?

    Thanks 

    Venkat

    Thursday, April 18, 2013 1:59 PM

Answers

All replies

  • You need to read the PR_LAST_VERB_EXECUTION_TIME property (DASL name "http://schemas.microsoft.com/mapi/proptag/0x10820040").

    The property can be accessed using MailItem.PropertyAccessor.GetProperty.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Thursday, April 18, 2013 2:29 PM
  • Hi Dmitry,

    I worked on this and it's solved my problem, thanks alot..........

    Thanks,

    Venkat

    Friday, April 19, 2013 10:15 AM
  • Hi All,

    This is working fine for me in Outlook 2007 & 2010 but it's not working for Outlook 2003

    Outlook.PropertyAccessor 

    I am not able to find PropertyAccessor

    Can any one please help me on this

    Thanks,

    Venkat_t919

    Monday, April 22, 2013 2:13 PM
  • PropertyAccessor was added in Outlook 2007.

    In the earlier versions of Outlook, you can use Redemption:

    Redemption.SafeMailItem sItem = new Redemption.SafeMailItem();
    sItem.Item = YourOutlookMailItem;
    DateTime dt = sItem.Fields[0x10820040];
    


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Monday, April 22, 2013 2:29 PM
  • Hi Dmitry, Thanks alot for you reply...

    I tried with Redemption as you mentioned in the above mail.

    You given DateTime dt = sItem.Fields[0x10820040]; but in my code it's not populating Fields  could you please check the below screenshot and advice me...

    http:// 2.bp.blogspot.com/ -3XD14BelLuA/ UXZwytqhtFI/ AAAAAAAAAGc/ l7DYa9OzzeM/ s1600/ Error_Redemption.png

    Please remove the space after every slash symbole in the above link

    Thanks,

    Venkat_t919

    Tuesday, April 23, 2013 7:29 AM
  • I cannot access that URL. What exactly happens? Do you get an unexpected value?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, April 23, 2013 12:33 PM
  • Hi Dmitry,  it's not giving .Fields option

    I uploaded the screenshot in the below link

    Copy the link and paste it in addressbar and then remove the space after every slash symbole "/"

    Example http:// 2.bp.blogspot.com here after // there a space, please remove this space.

    http:// 2.bp.blogspot.com/ -3XD14BelLuA/ UXZwytqhtFI/ AAAAAAAAAGc/ l7DYa9OzzeM/ s1600/ Error_Redemption.png

    actually it's not allowing me to add any link or image in this mail..

    Thanks,

    Venkat_t919

    Tuesday, April 23, 2013 1:19 PM
  • If you provide me any email i will send screenshot to your email

    Tuesday, April 23, 2013 1:21 PM
  • If you are using .Net 4.0, the syntax is SafeMialItem.Fields[].

    If you are using an earlier version of .Net, it will be SafeMailItem.put_Fields() or SafeMailItem.set_Fields().

    What does Intellisense show after you type "sItem." and hit Ctrl+Space?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, April 23, 2013 1:28 PM
  • it's showing sItem.set_Fields
    Tuesday, April 23, 2013 1:41 PM
  • So that is what you need to use then...

    DateTime dt = sItem.get_Fields(0x10820040);


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, April 23, 2013 1:58 PM
  • Hi Dmitry, 

    I am using VisualStudio-2008, .NetFrameWork 3.5 & Outlook-2003

    May I know what is the code for this version..?

    when i hit Ctrl+Space after sItem it's showing below syntax

    sItem.set_Fields(int PropTag, object Value)

    Below is my code

    foreach (Outlook.MailItem mail in items) { DateTime MailReceivedDateTime = mail.ReceivedTime; //I got this value

    Redemption.SafeMailItem sItem = new Redemption.SafeMailItem(); sItem.Item = items; DateTime MailRepliedTime = sItem.set_Fields(); // I stuck here }


    Thanks,

    Venkat_t919


    Tuesday, April 23, 2013 2:02 PM
  • You are trying to read a property, not to set it, so you need to use what I had in my previous reply:

    DateTime dt = sItem.get_Fields(0x10820040);


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, April 23, 2013 2:24 PM
  • Thanks a ton for all your valuable time and solutions........... it's solved my problem

    Once again Thanks alot Dmitry :) :)

    Tuesday, April 23, 2013 2:57 PM