SPViewStyle Class

The SPViewStyle class represents a style for a view.

System.Object

   Microsoft.SharePoint.SPViewStyle

Public Properties

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

Name Data Type Description
BaseTemplate Microsoft.SharePoint.SPListTemplateType Gets the list definition type on which the view style is based.
BaseType Microsoft.SharePoint.SPBaseType Gets the base list type on which the view style is based.
HasBaseType Boolean Gets a Boolean value that indicates whether the view style is based on one of the built-in base types for lists.
HasTemplateType Boolean Gets a Boolean value that indicates whether the view style is based on one of the built-in list definition types.
ID Int32 Gets the ID for the view style.
Script String Gets a section of script from the view style.
Title String Gets the name of the view style.
ViewFields Microsoft.SharePoint.SPViewFieldCollection Gets the collection of view fields for the style.

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

View styles are defined in either of two front-end VWSTYLE.XML files located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\MPS\XML directory or the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\STS\XML directory.

Use the ViewStyles property of the SPWeb class to return the collection of view styles for a site. Use an indexer to return a single view style from the collection. For example, if the collection is assigned to a variable named myViewStyles, use myViewStyles[index] in C#, or myViewStyles(index) in Visual Basic .NET, where index is the index number of the view style in the collection.

Example

The following code example iterates through the collection of view styles for a site and displays the names of styles that have view fields and the names of the fields.

This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint, Microsoft.SharePoint.Utilities, and Microsoft.SharePoint.WebControls namespaces.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

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

Security: Code Access Security