Application.ComAddIns Property
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)
Syntax
'Declaration
'Usage
Property Value
A Microsoft.Office.Core.COMAddIns collection that contains information about the COM Add-ins registered for the current InfoPath application.
Exceptions
Exception type | Condition |
---|---|
The form template is not configured for Full Trust using the Security and Trust category of the Form Options dialog box. |
Remarks
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 12.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 as 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 Office InfoPath 2007.
Example
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);
Dim objectReference As Object = 1
Dim app As Microsoft.Office.InfoPath.Application = _
Me.Application
Dim myComAddins As Microsoft.Office.Core.COMAddIns = _
DirectCast(app.ComAddIns, Microsoft.Office.Core.COMAddIns)
Dim myComAddIn As Microsoft.Office.Core.COMAddIn = _
myComAddIns.Item(objectReference)
See Also
Reference
Application Class
Application Members
Microsoft.Office.InfoPath Namespace