Reputation: 160
I've developed a VSTO add-in for Outlook using c#. In this add-in, I want to programatically select a public folder and navigate the user to it. The line I am using is:
_application.ActiveExplorer().CurrentFolder = projectFolder;
This successfully displays the contents of the folder and highlights the folder in the 'Folder List' tree, but it doesn't automatically scroll the folder list down so that the selected folder is visible on screen.
In a previous project, I used the same line of code (but in a VB6 COM add-in).
Set objOutlook.ActiveExplorer.CurrentFolder = mapDestFolder
In this case, it does scroll the folder view as desired.
Both add-ins above a are running in Outlook 2007
Is there any way I can get it to scroll the folder view when selecting the desired folder using the VSTO add-in?
Upvotes: 1
Views: 1617
Reputation: 26
You have add one row before setting up CurrentFolder
, as follows:
objOutlook.ActiveExplorer.Activate # This is what you need to add to your code.
Set objOutlook.ActiveExplorer.CurrentFolder = mapDestFolder
The ActiveExplorer.Activate
will do the trick of moving the focus to ActiveExplorer
.
And when you setup CurrentFolder
in the other row, it will already automatically scroll to your specified folder.
Upvotes: 1
Reputation: 2018
I had the same problem too, and got it working by doing nothing special other than setting the CurrentFolder property. I seem to remember the problem was to do with when the CurrentFolder is set.
In my code the Explorer.CurrentFolder is set last. So try setting the Explorer.CurrentFolder last.
Upvotes: 0