Share via


Solution Object

InfoPath Developer Reference

Corresponds to a Microsoft Office InfoPath 2007 form template.

Version Information
 Version Added:  InfoPath 2003

Remarks

The Solution 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 Solution object is accessed through the Solution property of the XDocument object.

For more information about using the Solution object, see Accessing application data.

Example

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.

JScript
  function SolutionInfo::OnClick(eventObj)
{
   var objSolution = XDocument.Solution;
   var strSolutionVersion = objSolution.Version;
   var objAuthorNode = objSolution.DOM
      .selectSingleNode("xsf:xDocumentClass/@author");
   var strAuthorText;

if (objAuthorNode != null) strAuthorText = objAuthorNode.text; else strAuthorText = "Author not available.";

XDocument.UI.Alert("Version: " + strSolutionVersion + "\nAuthor: " + strAuthorText); }

See Also