Comparteix a través de


InfoPath solutions

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio provides project templates you can use to create VSTO Add-ins for Microsoft Office InfoPath 2013 and InfoPath 2010. InfoPath is not available in Office 2016.

Note

You can still create a VSTO Add-in for InfoPath even if you've installed Office 2016. Just install InfoPath 2013 or Office 2013 side-by-side with Office 2016.

Applies to: The information in this topic applies to VSTO Add-in projects for InfoPath. For more information, see Features available by Office application and project type.

Note

Interested in developing solutions that extend the Office experience across multiple platforms? Check out the new Office Add-ins model. Office Add-ins have a small footprint compared to VSTO Add-ins and solutions, and you can build them by using almost any web programming technology, such as HTML5, JavaScript, CSS3, and XML.

VSTO Add-ins for InfoPath are similar to VSTO Add-ins for other Microsoft Office applications. These types of solutions consist of an assembly that is loaded by the application. End users can have access to the functionality of this assembly no matter which form or form template is open. For more information about VSTO Add-ins, see Get started programming VSTO Add-ins and Architecture of VSTO Add-ins.

Note

Visual Studio 2015 does not include the InfoPath form template projects that were provided in previous versions of Visual Studio. You also cannot use Visual Studio 2015 to open or edit an InfoPath form template project that was created in a previous version of Visual Studio. However, you can open and edit an InfoPath form template project by using Visual Studio Tools for Applications. For more information, see Work with VSTO 2008 projects in InfoPath 2010..

Automate InfoPath by using an add-in

To access the InfoPath object model from an Office VSTO Add-in created by using Office development tools in Visual Studio, use the Application field of the ThisAddIn class in your project. The Application field returns a Application object that represents the current instance of InfoPath. For more information, see Program VSTO Add-ins.

When you call into the InfoPath object model from a VSTO Add-in, you use types that are provided in the primary interop assembly for InfoPath. The primary interop assembly acts as a bridge between the managed code in the VSTO Add-in and the COM object model in InfoPath. All types in the InfoPath primary interop assembly are defined in the Microsoft.Office.Interop.InfoPath namespace. For more information about the InfoPath primary interop assembly, see About the Microsoft Office InfoPath primary interop assembly. For more information about primary interop assemblies in general, see Office solutions development overview (VSTO) and Office primary interop assemblies.

Customize the user interface of InfoPath by using an add-in

When you create a VSTO Add-in for InfoPath, you have several different UI customization options. The following table lists some of these options.

Task For more information
Create a custom task pane. Custom task panes
Add custom tabs to the Ribbon in InfoPath. Customize a Ribbon for InfoPath

For more information about customizing the UI of InfoPath and other Microsoft Office applications, see Office UI customization.

See also