Share via


SolutionObject interface

Corresponds to an InfoPath form template.

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

Syntax

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

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, seeSolution.

Using the members of the Solution interface provides compatibility with InfoPath 2003. To use new members that were added to the Solution2 object model in InfoPath 2010, you must cast the object returned by the Solution property of the XDocument object to the Solution2 type. For more information, see How to: Use Microsoft.Office.Interop.InfoPath.SemiTrust Members That Are Not Compatible with InfoPath 2003.

The SolutionObject object implements properties for getting information about a form template, including its version number, the Uniform Resource Locator (URL) of its extracted form files, the URL it was loaded from, and an XML Document Object Model (DOM) containing its form definition (.xsf) file.

The SolutionObject object is accessed through the Solution property of the XDocument object.

Examples

In the following example, a reference is set to the Solution object, then the code gets the name of the person who authored the form from the .xsf using the DOM property of the Solution object. A test is then made to determine if there is an author value, and the results are displayed in a message box.

[InfoPathEventHandler(MatchPath="SolutionInfo", EventType=InfoPathEventType.OnClick)]
public void SolutionInfo_OnClick(DocActionEvent e)
{
 Solution solution = thisXDocument.Solution;
 string solutionVersion = solution.Version;
 string authorText;
 IXMLDOMNode author = solution.DOM.selectSingleNode("xsf:xDocumentClass/@author");
  
 if (author != null)
 {
  authorText = author.text;
 }
 else
 {
  authorText = "Author not available.";
 }

 thisXDocument.UI.Alert("Version: " + solutionVersion + "\nAuthor: " + authorText);
}

See also

Reference

SolutionObject members

Microsoft.Office.Interop.InfoPath.SemiTrust namespace