Solution Object

Microsoft Office InfoPath

Show All Show All

Solution Object

Solution

Corresponds to a Microsoft Office InfoPath 2003 form template. 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.

Remarks

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

Using the Solution object

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.

    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);
}

  

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