XDocument.ViewInfos Property

InfoPath Developer Reference

A read-only property that returns a reference to the ViewInfos collection associated with a Microsoft Office InfoPath 2007 form. Read-only

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.ViewInfos

expression   An expression that returns a XDocument object.

Return Value
ViewInfos

Remarks

The ViewInfos collection contains a collection of ViewInfo objects that contain information about each of the views implemented in an InfoPath form.

Security Level 2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Example

In the following example, the ViewInfos property of the XDocument object is used to set a reference to the ViewInfos collection; then, using the Count property of the ViewInfos collection, it loops through the collection to determine the default view using the IsDefault property of the ViewInfo object. When the default view is found, the code displays the name of the view in a message box.

JScript
  var objViewInfos;
	
objViewInfos = XDocument.ViewInfos;
for (i=0; i < objViewInfos.Count; i++)
{
   if (objViewInfos(i).IsDefault)
   XDocument.UI.Alert("The default view is: " + objViewInfos(i).Name);
}

See Also