Partager via


GetView Method

The GetView method of the SPList class returns a view of the list based on the specified GUID.

Parameters

viewGuid   The GUID that identifies the view.

Return Value

A Microsoft.SharePoint.SPView object that represents the view.

Example

The following code example uses the GetView method to return a specified view for a list and passes this view as a parameter in the GetItems method in order to return and display items.

The ViewFields property gets the displayed fields in the list, which are then used in indexers for each list item.

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

The example assumes the existence of a .aspx page that contains a label control.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security