XmlForm.ViewInfos property

Office 2013 and later

Gets a reference to the ViewInfoCollection object associated with the form template.

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

public abstract ViewInfoCollection ViewInfos { get; }

Property value

Type: Microsoft.Office.InfoPath.ViewInfoCollection
A ViewInfoCollection that contains the ViewInfo objects associated with the form template.

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

This member 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.

This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.

In the following code example, the ViewInfos property of the XmlForm object is used to set a reference to the ViewInfoCollection for the form template. It then loops through each ViewInfo object in the collection to display the name of each view in a message box.

ViewInfoCollection viewInfos = this.ViewInfos;

foreach(ViewInfo thisView in viewInfos)
   MessageBox.Show("View name: " + thisView.Name);