# ViewInfos Property

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

expression.ViewInfos

expression Required. An expression that returns a reference to an XDocument object.

## 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.

## Remarks

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

## 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.

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

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp