ViewInfo Object

InfoPath Developer Reference

Contains descriptive information about a view within a Microsoft Office InfoPath 2007 form.

Version Information
 Version Added:  InfoPath 2003

Remarks

The ViewInfo object provides properties that can be used to get the name of a view and determine whether a view is the default view of the form. The ViewInfo object is accessible through the ViewInfos property of the XDocument object.

Bb229876.vs_note(en-us,office.12).gif  Note
To work with the view programmatically, use the View object.

Example

In the following example, the IsDefault property of the ViewInfo object is used to determine whether a view is the default view of the form. Then the code uses the Name property of the ViewInfo object to display the name of the default view in a message box.

JScript
  var objViewInfos;

// Set a reference to the ViewInfos collection. objViewInfos = XDocument.ViewInfos;

// Determine the default view and display a // message box with its name. for (i=0; i < objViewInfos.Count; i++) { if (objViewInfos(i).IsDefault) XDocument.UI.Alert("The default view is: " + XDocument.ViewInfos(0).Name); }

See Also