[英]Expand/collapse folders in the Outlook navigation pane programmatically
I am writing an add-in for Outlook using C#. 我正在使用C#为Outlook编写加载项。 Is there are way to programmatically expand and collapse folders in the Outlook 2007 folders navigation pane?
有没有办法在Outlook 2007文件夹导航窗格中以编程方式展开和折叠文件夹? Also, is there an event fired when a folder is expanded?
另外,展开文件夹时是否会触发事件?
Outlook does not expose events that will allow you to expand or collapse the folders in the treeview. Outlook不公开允许您在树状视图中展开或折叠文件夹的事件。 You may be able to do this using the Windows API.
您可能可以使用Windows API来执行此操作。
There might be a way to expand (but not to collapse). 可能有一种扩展方式(但不会崩溃)。
Basically what you need to do is to go through your sub folders one by one during each step make the sub folder your current folder. 基本上,您需要做的是在每一步中逐个浏览子文件夹,以使子文件夹成为当前文件夹。
I have tested this in Outlook 2010 (VSTO) on addin startup. 我已在外接程序启动时在Outlook 2010(VSTO)中对此进行了测试。 So if you have the Parent Folder Folder A and its sub folders Folder A1, Folder A2 and Folder A3.
因此,如果您有上级文件夹文件夹A及其子文件夹文件夹A1,文件夹A2和文件夹A3。
In order to expand Folder A do the following: 为了展开文件夹A,请执行以下操作:
Now loop through all sub folders under Folder A and make each sub folder the current folder: 现在遍历文件夹A下的所有子文件夹,并使每个子文件夹成为当前文件夹:
(The code should be something like this) (代码应该是这样的)
Subfolders = FolderA.Folders 子文件夹= FolderA.Folders
For Each folder as outlook .folder in Subfolders 对于每个文件夹作为子文件夹中的Outlook .folder
Explorer.currentfolder = folder Explorer.currentfolder =文件夹
Next Folder 下一个资料夹
This method works for me so hope this would be hopeful 这种方法对我有用,所以希望这会很有希望
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.