Partilhar via


SPViewCollection Class

Represents a collection of SPView objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.SPBaseCollection
      Microsoft.SharePoint.SPViewCollection

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<SubsetCallableTypeAttribute> _
<ClientCallableTypeAttribute(Name := "ViewCollection", CollectionChildItemType := GetType(SPView),  _
    ServerTypeId := "{03C5D7A9-9541-4482-9919-CA0CCCF565A0}")> _
Public Class SPViewCollection _
    Inherits SPBaseCollection
'Usage
Dim instance As SPViewCollection
[SubsetCallableTypeAttribute]
[ClientCallableTypeAttribute(Name = "ViewCollection", CollectionChildItemType = typeof(SPView), 
    ServerTypeId = "{03C5D7A9-9541-4482-9919-CA0CCCF565A0}")]
public class SPViewCollection : SPBaseCollection

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 collViews, use collViews[index] in C#, or collViews(index) in Visual Basic, where index is the index number of the view in the collection, the name of the view, or the GUID for the view.

Thread Safety

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

See Also

Reference

SPViewCollection Members

Microsoft.SharePoint Namespace