none
Enable grouping by custom userproperties RRS feed

  • Question

  • Hi all,

    I have developed an outlook add-in that creates a pst file and adds mail items to it from details received as a DataTable. I am using Redemption to create the mail items. On the mail items I am setting a few UserProperties using the RDOUserProperties collection. I am displaying those properties to the user by setting the ViewXml of the folder.

    My problem is that although the custom properties are shown to the user correctly when I open the folder, if I try to sort using the custom property, the mail items are not grouped. The messages are correctly sorted, but they are grouped in one group ("messages"), instead of separate groups.

    How can I get the grouping function to work? Is it a setting on the xml or somewhere else? Any help will be appreciated!

    Thanks!

    Cheers,

    Thimila

    Tuesday, July 16, 2013 3:41 AM

Answers

  • Oh - unfortunately, View automation was not introduced until Outlook 2007.  You'll have to build the XML manually and put it in ViewXML, which is a major pain.

    Eric Legault (MVP: Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Wednesday, July 24, 2013 4:07 PM
    Moderator

All replies

  • Are you able to create a new view manually and group/sort it the way you want without code?

    BTW, setting ViewXML manually is not trivial! Try using the TableView and OrderFields objects to code your view instead of using markup:

    Outlook Views
    http://msdn.microsoft.com/en-us/library/ff869117.aspx


    Eric Legault (MVP: Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Tuesday, July 16, 2013 3:04 PM
    Moderator
  • Hi Eric,

    Thanks for the reply. Sorry for taking so long, I got sidetracked with some other issues reported.

    When creating a view manually, I added my custom field to the view using the "Fields" option on the "Customize View: Messages" window. However even then when I sort on that field the messages are not grouped properly. I need to customize the "Group By" option on the above window as well for the items to be grouped.

    I am setting up the viewXml when creating the folder using MAPIFolder.Folder.Add. So that the user will see my fields as the default view for that folder.

    I want to set it up so that when the users select to sort using the field, the messages(mails) should be grouped automatically. That is, I do not want to setup the default grouping, but ensure that mails are grouped if the user chooses my field to sort on.

    Note: The add-in supports Outlook 2003 to 2010/13.

    Monday, July 22, 2013 4:06 AM
  • I believe the Explorer.SelectionChange event should fire in most cases when sorting or grouping is altered in a view.  Then at that point you can work with your TableView object and set TableView.GroupByFields accordingly.

    Eric Legault (MVP: Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Monday, July 22, 2013 7:17 PM
    Moderator
  • Can you do that on a user property added using the Outlook Object Model?

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

    Tuesday, July 23, 2013 5:43 AM
  • Thanks for your replies!

    Dmitry, no it does not group automatically even for properties added through the Outlook object model.

    Tuesday, July 23, 2013 8:59 AM
  • Is my suggestion helpful in any way?  If you can build the view manually, you can build the view in code.  It's building it on the fly during a specific event that's the tricky part.

    Eric Legault (MVP: Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Tuesday, July 23, 2013 7:09 PM
    Moderator
  • Hi Eric,

    I am unable to find the TableView object. Is it available on Outlook 2003? Could you tell me how to access it? Is it in the Explorer or Folder object?

    Wednesday, July 24, 2013 12:51 AM
  • Oh - unfortunately, View automation was not introduced until Outlook 2007.  You'll have to build the XML manually and put it in ViewXML, which is a major pain.

    Eric Legault (MVP: Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Wednesday, July 24, 2013 4:07 PM
    Moderator