Adding/removing ViewFields in the OnExplorerFolderSwitch-event.

Add-in Express™ Support Service
That's what is more important than anything else

Adding/removing ViewFields in the OnExplorerFolderSwitch-event.
Adding/removing ViewFields in the OnExplorerFolderSwitch-event. 
N.Meyer




Posts: 26
Joined: 2012-11-07
Hello,

we are experiencing troubles adding/removing ViewFields in the OnExplorerFolderSwitch-event.
In our AddIn we have a RibbonButton, if this Button is pressed a certain _ViewField is added to/removed from the current View of the current folder. If we select another folder, the viewField should be added to/removed from (if neccessary) the now selected folder, depending on whether the button is down or not (this value is saved in the registry and read on addIn startup).
In order to do so, we basically call CurrentFolder.CurrentView.ViewFields.Add/Remove + TableView.Apply in the OnClick-Event of the button as well as in the OnExplorerFolderSwitch-Event of the AddIn module.

In generally this works fine, except for:
1. If a button is not down on AddIn-Start, the button actually needs to be pressed 3 times in order to show the additional column, vice versa if the button is down on AddIn-Start, it needs to be pressed 3 times to hide the column. From now on everything works as expected.
If we navigate to another folder and then navigate back to the initial one before pressing the button, everything works fine, too.

2. If the button is pressed when we navigate from the folder initially show at AddIn-Startup to another folder, press the button and close Outlook, then the column is not show at the initial folder when restarting Outlook, although the button is correctly down. (this means, the ViewFields.Add method is called, but for somesome reason the column is not shown)

Best regards and thanks in advance.
Posted 07 Mar, 2018 10:33:36 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Nedeljka,

I suggest that you add ViewColumn objects *after* that event completes. You can use a timer to create a small delay and manipulate the columns after the delay is over.

N.Meyer writes:
1. If a button is not down on AddIn-Start, the button actually needs to be pressed 3 times in order to show the additional column, vice versa if the button is down on AddIn-Start, it needs to be pressed 3 times to hide the column.


Did you debug this scenario?


Andrei Smolin
Add-in Express Team Leader
Posted 09 Mar, 2018 06:32:03 Top