Home > database >  How to create view and group by from field in inbox folder?
How to create view and group by from field in inbox folder?

Time:11-23

I want to programmatically create view and group by from field in the inbox folder

I tried with the below code, but not working

Thanks

`Outlook.Folder inbox = GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox) as Outlook.Folder;
                Outlook.View inboxView = inbox.CurrentView;
                var xml = inboxView.XML;
                var inboxChild = inbox.Folders[1];
                Outlook.TableView view = inboxChild.Views.Add("Brendan View25", Outlook.OlViewType.olTableView) as Outlook.TableView;
                view.AutomaticGrouping = false;
                Outlook.OrderFields fields = view.GroupByFields;
                fields.Add("From");
                view.Apply();`

CodePudding user response:

The best way to find out what is wrong with the view applied in Outlook is to export the current view (its XML representation) in Outlook to an XML file and compare with view set up manually. That is how I am working with View objects in Outlook and troubleshoot them when required.

  • Related