How to display same view in different folders? RRS feed

  • Question

  • Hello,

    I want to know if is it possible to display the same userproperties in a view, in different folders? what I mean is I created custom userproperties, in each folder that I selected. it works perfectly, but I want to show programmatically all of those userproperties in each folder where they're stored. With the following code, it creates userproperties in each folders, it shows automaticaly all of those userproperties, and a message error at the end "An attempt has been made to add the same field more than once" . What should I do to avoid this error message

     foreach (Folder destination in arrText1)
                                 Outlook.Items items = destination.Items;
                                 foreach (Outlook.MailItem mail in items)
                                     Outlook.UserProperties userProperties = mail.UserProperties;
                                     Dispatch = userProperties.Add("tested by", Outlook.OlUserPropertyType.olText, true, Outlook.OlFormatText.olFormatTextText);
                                     DueDate = userProperties.Add("Due date test", Outlook.OlUserPropertyType.olDateTime, true, Outlook.OlFormatDateTime.olFormatDateTimeLongTime);                             
                                     if (destination.CurrentView.ViewType == Outlook.OlViewType.olTableView)
                                             Outlook.TableView tableView = destination.CurrentView as Outlook.TableView;
                                             Outlook.ViewField viewField = tableView.ViewFields.Add("tested by");
                                             Outlook.ViewField viewField2 = tableView.ViewFields.Add("Due date test");
                                             Outlook.ColumnFormat columnFormat = viewField.ColumnFormat;
                                             columnFormat.Align = Outlook.OlAlign.olAlignLeft;
                                             columnFormat.Width = 10;
                                         catch(SystemException ex)

    Thanks in advance

    • Moved by Cindy Meister MVP Tuesday, October 1, 2013 4:48 PM Outlook question, not answered in VSTO forum
    Thursday, September 19, 2013 9:14 AM