Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Add method of the SPWebPartCollection class adds the specified List View Web Part to the collection.
Parameters
listWebPart A ListViewWebPart object that represents the new Web Part.
Return Value
A GUID that identifies the Web Part.
Example
The following example adds a List View Web Part to the collection of Web Parts that are displayed on the home page of the current site.
The ListName and ViewGuid properties both require a GUID represented as a string that uses all-uppercase characters and that is enclosed within curly braces ({ }).
This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint, Microsoft.SharePoint.WebControls, and Microsoft.SharePoint.WebPartPages namespaces.
Requirements
Platforms: Microsoft Windows Server 2003
Security: Code Access Security