views:

19

answers:

0

Hi all,

Here at my company we use a E-mailclient different then Outlook. When we copy our conversations to the Exchange imap folder, the recievedtime property is set to the current date.

Is it possible to programmaticaly change this property? Currently I get the error that this property is read-only.

My current code:


private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    foreach (Outlook.Folder Map in Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Folders)
    {
        if (Map.Name != "some_name")
            continue;
        if (MessageBox.Show("mes", "title", MessageBoxButtons.OKCancel) != DialogResult.OK)
            break;
        foreach (Object Item in Map.Items)
        {
            try
            {
                String Message = "";
                Outlook.MailItem Mail = (Outlook.MailItem)Item;
                Message += "Sent by: \"" + Mail.SenderName + "\" \n";
                Message += "Sent on: " + Mail.SentOn.ToString() + "\n";
                Message += "Received on: " + Mail.ReceivedTime.ToString();
                MessageBox.Show(Message);

                Mail.ReceivedTime = Mail.SentOn;
               //Property or indexer 'Microsoft.Office.Interop.Outlook._MailItem.ReceivedTime' cannot be assigned to: it is read only
            }
            catch (Exception Exception)
            {
            }
        }
    }
}