Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SPView Class
Collapse the table of content
Expand the table of content

SPView Class

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

System.Object
  Microsoft.SharePoint.SPView

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

[SubsetCallableTypeAttribute]
public class SPView

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.

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