SPFile.GetWebPartCollection method

NOTE: This API is now obsolete.

Use the GetLimitedWebPartManager method to return an SPLimitedWebPartManager object to manage Web Parts instead. (In Windows SharePoint Services 2.0 the GetWebPartCollection method returned the Web Part collection that is associated with the Web Parts page.)

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

[ObsoleteAttribute("Use SPFile.GetLimitedWebPartManager instead.")]
public SPWebPartCollection GetWebPartCollection(
	Storage storage


Type: Microsoft.SharePoint.WebPartPages.Storage

A Storage value that specifies the scope of the collection that is returned according to all or individual users of the collection.

Return value

Type: Microsoft.SharePoint.SPWebPartCollection
An object that represents the Web Parts.

The GetWebPartCollection method does not return static Web Parts, which are hard-coded into the .aspx source of the page.