TaskPaneObject interface

Represents a task pane in a Microsoft InfoPath form that is associated with a window.

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

Syntax

'Declaration
<GuidAttribute("096cd58e-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface TaskPaneObject _
    Inherits TaskPane
'Usage
Dim instance As TaskPaneObject
[GuidAttribute("096cd58e-0786-11d1-95fa-0080c78ee3bb")]
public interface TaskPaneObject : TaskPane

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeTaskPane.

The TaskPaneObject object provides properties for working with the InfoPath built-in task panes. The HTMLTaskPaneObject object inherits those properties for working with a custom task pane.

The properties available for an InfoPath task pane are determined by the type of task pane that you are working with. If the TaskPaneType property returns 0, the task pane is a custom task pane and the properties and methods available are provided by the HTMLTaskPane object. If the TaskPaneType property returns any other value, the task pane is a built-in task pane and the properties are provided by the TaskPaneObject object.

Note

TaskPaneType is based on XdTaskPaneType enumeration. These enumerated values are also used as arguments to the property Item of the TaskPanesCollection collection for returning a reference to a specified type of task pane.

Examples

In the following example, the Item property of the TaskPanesCollection collection is used to get a reference to the TaskPane object that represents the custom task pane. The code then calls a scripting function defined in the HTML code of the custom task pane using the HTMLDocument property of the HTMLTaskPaneObject object, which is inherited by the TaskPane object.

// Ensure View has loaded before trying to access the task pane.
if (thisXDocument.View != null)
{
 // Get a reference to the custom task pane.  It is always the 0-th
 // task pane in the TaskPanes collection.
 HTMLTaskPane custom = (HTMLTaskPane) thisXDocument.View.Window.TaskPanes[0];

 // Ensure that the task pane is completely loaded.
 if (custom != null && custom.HTMLDocument.readyState == "complete")
 {
  mshtml.IHTMLWindow2 window = custom.HTMLDocument.parentWindow;

  object[] args =  new object[] {"ViewID"};

  // call into script through CLR late binding mechanism
  window.GetType().InvokeMember(
   "SelectView",      // late bound method      
   System.Reflection.BindingFlags.InvokeMethod |   // binding flags
   System.Reflection.BindingFlags.DeclaredOnly | 
   System.Reflection.BindingFlags.Public | 
   System.Reflection.BindingFlags.Instance,     
   null,        // binder object
   window,        // target object
   args);
 }
}

Note

The above example requires a reference to the Microsoft.mshtml.dll assembly.

See also

Reference

TaskPaneObject members

Microsoft.Office.Interop.InfoPath.SemiTrust namespace