Application.ComAddIns property

Office 2013 and later

Gets a Microsoft.Office.Core.COMAddIns object containing information about the COM Add-ins registered for the current InfoPath application.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

public abstract Object ComAddIns { get; }

Property value

Type: System.Object
A Microsoft.Office.Core.COMAddIns collection that contains information about the COM Add-ins registered for the current InfoPath application.

ExceptionCondition
SecurityException

The form template is not configured for Full Trust using the Security and Trust category of the Form Options dialog box.

The COMAddIns object returned by the InfoPath ComAddIns property is implemented in the Microsoft.Office.Core namespace. The Microsoft.Office.Core.COMAddIns object provides information about the collection of InfoPath COM add-ins that are registered in the Windows registry of the user's computer. To access the members of Microsoft.Office.Core namespace, you must first add a reference to the Microsoft Office 14.0 Object Library on the COM tab of the Add Reference dialog box in Visual Studio.

To use the Microsoft.Office.InfoPath.ComAddIns property to access the Microsoft.Office.Core.COMAddIns object, you must cast the InfoPath ComAddIns property to the Office COMAddIns type as shown in the code example.

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

The following example accesses the first item in the COMAddIns collection that is returned by the ComAddIns property.

Object objectReference = 1;
Microsoft.Office.InfoPath.Application app = 
   this.Application;

Microsoft.Office.Core.COMAddIns myComAddIns = 
   (Microsoft.Office.Core.COMAddIns)app.ComAddIns;

Microsoft.Office.Core.COMAddIn myComAddIn = 
   myComAddIns.Item(ref objectReference);
Show: