本文转自:https://www.add-in-express.com/creating-addins-blog/2013/05/21/outlook-ui-customization-ribbons-toolbars/

The Outlook UI provides a lot of customization options, but one thing almost all Outlook add-ins share is either a ribbon tab or a toolbar or two. The Ribbon UI was introduced in Office 2007 although only the Inspector windows actually used it. The Explorer window still used the traditional menus and toolbars from previous Outlook versions.

Whichever version of Outlook you decide to develop for, Add-in Express for Office and .net provides visual designers and tools for both the Ribbon UI as well as for toolbars. Add-in Express fully supports Outlook 2013, 2010, 2007 and 2003 and works with Visual Studio 2012 – 2005 (C#, VB.NET or C++ .NET) .

 

Creating a custom Outlook ribbon

Before you can create your own Outlook ribbon, you need to add an ADXRibbonTab component to the AddinModule designer surface.

When you select the ADXRibbonTab component in Visual Studio, the visual designer will become active. When designing your Ribbon Tab, you need to follow a certain hierarchy, for example, any control you add to the Ribbon Tab, needs to be inside a Ribbon Group first.

You can add a Ribbon Group by clicking on its toolbar button inside the visual designer. The visual designer will display the control hierarchy as well as a preview of what the Ribbon Tab will look like inside Outlook.

You need to stipulate the Ribbons property in order to specify where in Outlook your ribbon tab should be displayed.

Find more about Ribbon designer.

Ribbon context-sensitivity

This property is available on all ribbon controls and it enables you to display or hide different controls based on the type of item in Outlook. Consider the following ribbon design:

The Ribbons property of the first ribbon group is set to OutlookMailRead and OutlookMailCompose. The second ribbon group’s Ribbons property is set to OutlookContact. When building and running the add-in in Outlook, you’ll only see the first ribbon group when you either edit or open an e-mail.

The second ribbon group will be visible when you have a contact inspector window open. Be careful thought, for this to work the Ribbon Tab’s Ribbons property needs to be set to OutlookMailRead,OutlookMailComposeandOutlookContact.

 

Creating a custom Outlook toolbar

Creating a custom toolbar or a commandbar for any pre-ribbon versions of Outlook 2007, 2003 and 2000 is done in a similar fashion as creating ribbons. However, Add-in Express provides two separate command bar components for pre-ribbon versions of Outlook:

  • ADXOLExplorerCommandBar
  • ADXOLInspectorCommandBar

The names of the two components are pretty self-explanatory. When you would like to add controls to an existing or create a new toolbar for the Outlook Explorer window, you would need to use the ADXOLExplorerCommandBar component.

For all other pre-ribbon Outlook Inspector windows you would need to use the ADXOLInspectorCommandBarcomponent.

When you select the ADXOLExplorerCommandBar component in Visual Studio, Add-in Express will display a visual designer for you, to visually design the toolbar.

The visual designer also comes with its own toolbar that contains all the standard commandbar controls you can add. However, I want to draw your attention to a very special control: the CommandBar Advanced Control.

This control gives you the ability to embed any non-Office control to an Outlook toolbar. This can include anything from a date picker to a tree view control!

Find more about Toolbar designer.

Advanced Toolbar control

Once you’ve added an advanced command bar control to your toolbar, you need to add the control you want to embed to the AddinModule designer surface. In this example, I’ve simply dragged a DateTimePickercontrol onto my designer surface.
Next, you’ll need to add an Outlook Control Adapter control onto the designer surface as well. You’ll find this control in your Visual Studio toolbox, under the “Toolbar Controls for Microsoft Office” group.

With the control adapter in place, select the advanced command bar control and select the name of the Date Picker control in the drop-down list next to the Control property.

With the controls and properties in place, we can build, register and run our Outlook add-in project. When you have your Inbox open in Outlook 2007 and earlier, you should see the following toolbar:

Toolbar context-sensitivity

As with the ribbon control you can also display a toolbar or certain controls on the toolbar depending on the folder name or item types (Mail, Contact, Task, Calendar etc.). If you want to show the toolbar when a certain folder is selected, specify the folder name in the FolderName property. If you need it to show for a collection of forms, add their folder names to the FolderNames property.

If, for example, you would only like to show certain components on the toolbar based on which type(s) of item is selected, select the toolbar component and either specify the Outlook item type in the OlExplorerItemTypes or OlInspectorItemTypes property depending on whether you’re using an Explorer or Inspector toolbar.

And as easy as that you can have a toolbar which only shows or hides certain controls depending on the types of items or folders that are selected.

Thank you for reading! Until next time, keep coding!

 

Outlook 2013 add-in development in Visual Studio 2012 for beginners

You may also be interested in:

最新文章

  1. java String 的+操作导致的问题
  2. QtCreator动态编译jsoncpp完美支持x86和arm平台
  3. [MCSM] 蒙特卡罗统计方法
  4. Android代码写View
  5. ExtJs之Ext.util.CSS
  6. EF的TransactionScope
  7. js转换/Date(........)/
  8. leetcode Contains Duplicate II python
  9. HPQC HP Quality Center windows 服务
  10. Azure机器学习入门(三)创建Azure机器学习实验
  11. 并行cmd
  12. 19,CSS 滤镜
  13. Android路由框架-ARouter详解
  14. 师大校赛D coloring Game 并查集
  15. centos7.2 开机启动脚本
  16. [UGUI]修改顶点
  17. 说一下acad的bug及问题
  18. maven与jdk版本不一致报:Unsupported major.minor version 51.0
  19. Websphere下删除某个文件(ibm-partialapp-delete.props)
  20. 2018.09.26 bzoj1015: [JSOI2008]星球大战starwar(并查集)

热门文章

  1. linux系统编程之文件与IO(七):时间函数小结
  2. NET 下载共享文件
  3. 利用HttpWebRequest模拟表单提交
  4. (zxing.net)一维码MSI的简介、实现与解码
  5. winform程序更新
  6. 2D Polygons( Poygon) CGAL 4.13 -User Manual
  7. CentOS 6 - 升级内核
  8. jzoj5879. 【NOIP2018提高组模拟9.22】电路图 B
  9. Array-Find Pivot Index
  10. 去除eclipse的validating