Share via


SPView Class

Represents a view of the data that is contained in a list on a SharePoint site.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPView

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

Syntax

'Declaration
<SubsetCallableTypeAttribute> _
Public Class SPView
'Usage
Dim instance As SPView
[SubsetCallableTypeAttribute]
public class SPView

Remarks

Use the DefaultView property of the SPList class to return the default view for a list, or the GetView() method to return a specified view. Use the GetViewFromUrl() method of the SPWeb class to return a view for a list within a site, and use the View property of the SPViewFieldCollection class to get the parent view of the collection of view fields. Otherwise, use the Views property of either the SPList class or the 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

SPView Members

Microsoft.SharePoint Namespace