Specific Use-Cases

DotNetBrowser & VSTO

This tutorial shows how to create a VSTO add-in and embed DotNetBrowser into Microsoft Outlook.

DotNetBrowser provides a WinForms BrowserView control that can be used with VSTO add-ins to add the Chromium-based browser as an integral part of a Microsoft Office application. In this tutorial, we will show how to embed a BrowserView control into the Microsoft Outlook inspector.

  1. In Visual Studio, create a sample add-in project for Microsoft Outlook. You can find the corresponding project template in the “VSTO Add-ins” section: Create Add-in Project

  2. Add all the necessary references to our project. To do so, in the Solution Explorer, right-click the References node and select Add Reference…: Add Reference

  3. Select all the required DotNetBrowser assemblies and click Add: Select Referenced Assemblies

  4. Configure the DotNetBrowser license as described in this section.

  5. To make the add-in debugging more convenient, configure DotNetBrowser logging during add-in initialization and specify the location to store the log file as shown below: Configure Logging

  6. Add a form region which is used to replace or customize the standard Outlook forms. To do so, right-click the project node in the Solution Explorer and select Add New Item: Add Form Region

  7. Specify how the Outlook form region is created. To do so, select the Design a new form region option and click Next. Design New Form Region

  8. Select the form region type. In this tutorial, we create this form region as a separate page on the form. Select Form Region Type

  9. Type the form region name and select the inspector types where this form region appears and click Next. Specify Form Region Name

  10. Select the message classes to specify the Outlook item types for which the form region should be available. For example, selecting IPM.Note makes the form region available for the email messages. Select Message Classes

  11. Click Finish. After the form region is created, the form region designer opens. To make it more convenient, add the BrowserView control to the Visual Studio Toolbox. There are a few ways to do this, and the most straightforward of them is to add it from the assembly manually. To do so, right-click the Toolbox and select Choose Items…: Choose Toolbox Items

  12. The Choose Toolbox Items dialog appears. Click the Browse button to add the BrowserView control to the list: Browse Toolbox Items

  13. In the file chooser, select the DotNetBrowser.WinForms assembly that contains the BrowserView control: Select Toolbox Item Assembly

  14. Make sure that the BrowserView control is now listed and selected, and click OK. Select Framework Component

  15. The BrowserView control appears in the Visual Studio Toolbox: BrowserView In Toolbox

  16. Add the BrowserView control to the form region from the Toolbox and adjust its layout. For example, you can specify its Dock property as Fill to fill the whole form region with the control: Designer With BrowserView

  17. Create an IBrowser instance and initialize BrowserView before the region is displayed. BrowserView Initialization

  18. Build and run the project to launch Microsoft Outlook with the sample add-in configured. In the Outlook window, click the New Email button. New Email

  19. Microsoft Outlook form appears. In the form ribbon, you can notice the BrowserFormRegion button. BrowserView In Toolbox

  20. Click the BrowserFormRegion button, to display the sample form region with the embedded BrowserView. BrowserView In Toolbox

Go Top