SPViewStyle class
Represents a style for a view.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
View styles are defined in \\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\GLOBAL\XML\VWSTYLES.XML.
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 collViewStyles, use collViewStyles[index] in C#, or collViewStyles(index) in Visual Basic, where index is the index number of the view style in the collection.
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 and Microsoft.SharePoint.Utilities namespaces.
Note |
|---|
Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects. |
Note