SPViewCollection Class

The SPViewCollection class represents a collection of SPView objects.

System.Object

   Microsoft.SharePoint.SPBaseCollection

      Microsoft.SharePoint.SPViewCollection

Public Methods

The following table shows the public methods of the SPViewCollection class and a brief description of each.

Name Description
Add(String, System.Collections.Specialized.StringCollection, String, Int32, Boolean, Boolean) Creates a view in the collection with the specified name, view fields, query string, row limit, and Boolean values that specify whether the view displays items page by page and whether it is the default view.
Add(String, System.Collections.Specialized.StringCollection, String, UInt32, Boolean, Boolean, Microsoft.SharePoint.SPViewCollection.SPViewType, Boolean) Creates in the collection a view with the specified name, view fields, query string, row limit, Boolean values specifying whether the view displays items page by page and whether it is the default view, the view type, and a Boolean value specifying whether the view is personal or public.
Delete Deletes the view with the specified GUID from the collection.

Public Properties

The following table shows the public properties of the SPViewCollection class, the data type of each property, and a brief description of each.

Name Data Type Description
Count Int32 Gets the number of views in the collection.
Item(Int32) Microsoft.SharePoint.SPView Gets the view object at the specified index in the collection.
Item(String) Microsoft.SharePoint.SPView Gets the view object with the specified name from the collection.
Item(System.Guid) Microsoft.SharePoint.SPView Gets the view object with the specified GUID from the collection.
List Microsoft.SharePoint.SPList Gets the parent list for the view collection.
SchemaXml String Gets the complete view schemas for the collection.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.

Remarks

Use the Views property of either the SPList or SPView class to return the collection of views for a list or the parent collection of views for a view. Use an indexer to return a single view from a collection of views. For example, if the collection is assigned to a variable named myViews, use myViews[index] in C#, or myViews(index) in Visual Basic .NET, where index is the index number of the view in the collection, the name of the view, or the GUID for the view.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security