简体   繁体   English

以编程方式展开/折叠Outlook导航窗格中的文件夹

[英]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,请执行以下操作:

  1. Get the active explorer (Globals.thisaddin.application.activeexplorer) 获取活动的资源管理器(Globals.thisaddin.application.activeexplorer)
  2. Set the current folder explorer.currentfolder = Folder A 设置当前文件夹explorer.currentfolder =文件夹A
  3. 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.

相关问题 WPF功能区以编程方式折叠和展开 - WPF Ribbon collapse and expand programmatically Outlook Addin VSTO-按需扩展文件夹 - Outlook Addin VSTO - On demand expand folders 如何最小化/折叠Outlook插件自定义任务窗格,与“文件夹窗格”相同? - How to Minimize/Collapse outlook-addin custom task pane as same as Folder Pane? VSTO Outlook:无法以编程方式设置自定义任务窗格高度 - VSTO Outlook: Cannot set custom task pane height programmatically 从 Outlook VSTO 插件扩展交换在线公用文件夹 - Expand exchange online public folders from Outlook VSTO addin 如何以编程方式在Windows 10资源管理器的导航窗格中创建指向文件夹的链接 - How to create link to folder in navigation pane of Windows 10 explorer programmatically 有没有办法从Outlook中导航窗格中检索并突出显示光标当前结束的文件夹? - Is there any way to retrieve and highlight the folder from the navigation pane in Outlook that the cursor is currently over? 需要VBA代码以使文件夹在Outlook 2010的导航/树视图窗格中可见 - need VBA code to make a folder visible in the navigation/treeview pane of Outlook 2010 Radpanelbar崩溃/扩展问题 - Radpanelbar collapse/expand issue 具有折叠/展开的控件树视图 - Treeview of Controls with collapse/expand
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM