Edit

Share via


_XDocument2.ViewInfos Property

Definition

Gets a reference to the ViewInfosCollection collection associated with a form.

public:
 property Microsoft::Office::Interop::InfoPath::SemiTrust::ViewInfosCollection ^ ViewInfos { Microsoft::Office::Interop::InfoPath::SemiTrust::ViewInfosCollection ^ get(); };
public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfosCollection ViewInfos { get; }
member this.ViewInfos : Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfosCollection
Public ReadOnly Property ViewInfos As ViewInfosCollection

Property Value

Implements

Examples

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

<span class="label">ViewInfos</span> viewInfos;
viewInfos = thisXDocument.<span class="label">ViewInfos</span>;

for (int i=0; i &lt; viewInfos.Count; i++)
{
 if (viewInfos[i].IsDefault)
 {
  thisXDocument.UI.Alert("The default view is: " + viewInfos[i].Name);
 }
}

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

<span class="label">ViewInfos</span> viewInfos;
viewInfos = thisXDocument.<span class="label">ViewInfos</span>;

for (int i=0; i &lt; viewInfos.Count; i++)
{
 if (viewInfos[i].IsDefault)
 {
  thisXDocument.UI.Alert("The default view is: " + viewInfos[i].Name);
 }
}

Remarks

The ViewInfos collection contains a collection of ViewInfoObject object containing information about each of the views implemented in an InfoPath form.

Important: 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.

Applies to