Partager via


SPView Class

The SPView class represents a view of the data contained in a list on a SharePoint site.

System.Object

   Microsoft.SharePoint.SPView

Public Methods

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

Name Description
ApplyStyle Applies the specified style to the view.
Clone Creates and returns a duplicate of the view.
GetAggregationString Returns the formula that is applied in an aggregate, or total, view of a list column.
RenderAsHtml() Returns the view in HTML format.
RenderAsHtml(Boolean, Boolean, String) Returns the view in HTML format but allows for rendering within a frameset.
ToString Returns the title of the view.
Update Updates the content database with changes made to the view.

Public Properties

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

Name Data Type Description
Aggregations String Gets or sets field references for one or more aggregate, or total, columns used in a view.
AggregationsStatus String Gets or sets a string that specifies whether aggregate, or total, columns are used in the view.
BaseViewID String Gets the ID of the base view for the view.
DefaultView Boolean Gets or sets a Boolean value that specifies whether the view is the default view.
EditorModified Boolean Gets a Boolean value that indicates whether the view was modified by using an HTML editor.
Formats String Gets or sets definitions for column and row formatting used in a datasheet view.
GroupByFooter String Gets or sets the definition of the Group By footer that is used in the view.
GroupByHeader String Gets or sets the definition of the Group By header used in the view.
Hidden Boolean Gets or sets a Boolean value that specifies whether the view is hidden.
HtmlSchemaXml String Gets the entire schema for the view.
ID System.Guid Gets the GUID that identifies the view.
ModerationType String Gets the moderation type for the view.
OrderedView Boolean Gets a Boolean value that indicates whether users can reorder items through the user interface.
Paged Boolean Gets or sets a Boolean value that specifies whether the list supports displaying more items by adding more pages when the number of items on a page exceeds a specified limit.
ParentList Microsoft.SharePoint.SPList Gets the parent list for the view.
PersonalView Boolean Gets a Boolean value that indicates whether the view is personalized.
PropertiesXml String Gets properties of the view, including the GUID, the type, the display name, the URL, and the ID of the base view.
Query String Gets or sets an XML string representing the query for the view.
ReadOnlyView Boolean Gets a Boolean value that indicates whether the view is read-only.
RecurrenceRowset Boolean Gets a Boolean value that specifies whether the view supports recurrence rowsets.
RowLimit UInt32 Gets or sets the maximum number of items to return in a view.
RowLimitExceeded String Gets or sets alternate rendering when the value set by the RowLimit property is exceeded.
SchemaXml String Gets the schema that defines the view.
Scope Microsoft.SharePoint.ViewScope Gets or sets the recursive scope for the view of a document library.
StyleID String Gets the ID of the view style for the view.
Threaded Boolean Gets a Boolean value that indicates whether the view is threaded.
Title String Gets or sets the display name for the view.
Toolbar String Gets or sets the toolbar for the view.
ToolbarType String Gets the type of toolbar used in the view.
Type String Gets the type of the view.
Url String Gets the URL of the main page that contains the view if applicable.
ViewBody String Gets or sets the body of the view.
ViewEmpty String Gets or sets what is displayed when the query returns no list data for the view.
ViewFields Microsoft.SharePoint.SPViewFieldCollection Gets the view fields used in the view.
ViewFooter String Gets or sets the footer area for the view.
ViewHeader String Gets or sets the header area for the view.
Views Microsoft.SharePoint.SPViewCollection Gets the parent view collection for the view.

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 DefaultView property of the SPList class to return the default view for a list, or the GetView method of the same class 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 either the SPViewFieldCollection class or the ViewSearchForm class to get either the parent view of a collection of view fields or the view of a search form. 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 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