none
Adding a date column to the email view RRS feed

  • Question

  • Hello, Vladamir had posted a soln for adding a yes/no type column to an email view.  Can someone help me add a DateTime column?  This doesn't seem to work.  Thanks!!

    Showing the Column "test"
    Outlook.TableView CurView = ((Outlook.TableView)selectedFolder.CurrentView);
    CurView.ViewFields.Add("Test");
    CurView.Apply();

    Creating column:
    Outlook.MailItem mailItem = (this.Application.ActiveExplorer().Selection[item] as Outlook.MailItem);
    mailItem.UserProperties.Add("Test", Outlook.OlUserPropertyType.olDateTime, true, Missing.Value);

    Change value to column: 
     mailItem.UserProperties["Test"].Value = mailItem.ReceivedTime;
     mailItem.Save();

    Tuesday, June 26, 2012 6:03 PM

Answers

  • Hi,

    Try adding this (and convert it to C# .. I'm on a machine with VBA only..) :

    'Add field to the Folder first:

    Dim f As Folder
    Set f = Application.ActiveExplorer.CurrentFolder
    f.UserDefinedProperties.Add "Test", olDateTime
    Set f = Nothing

    Tuesday, June 26, 2012 7:32 PM