"To obtain a View object for the view of the current Explorer, use Explorer.CurrentView instead of the CurrentView property of the current Folder object returned by Explorer.CurrentFolder."
myFolder.CurrentView may return the wrong view
We are developing an Outlook add-in which modify the CurrentView of folders when switching folders in Outlook.
However, we noticed a weird problem.
We retrieved the CurrentView of a folder roughly by:
…
Outlook.Folder myFolder = Application.ActiveExplorer().CurrentFolder as Outlook.Folder;
Outlook.TableView myView = myFolder.CurrentView;
…
Normally, the myView returns the correct view of the folder, but in some rare cases, it returns the view of the previous folder before switching.
E.g.
Folder = Inbox, View = View1
Folder = Sent Items, View = View2
When switching from Sent Items to Inbox, myFolder is Inbox, but myView retrieved may become View2.
How is this possible?
Will it help if we add one or two seconds of delay after switching folder and before reading the CurrentView?