Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetWebPartCollection method
Collapse the table of content
Expand the table of content

SPWeb.GetWebPartCollection method

NOTE: This API is now obsolete.

Use the GetLimitedWebPartManager method of the SPFile class to return an SPLimitedWebPartManager object to manage Web Parts instead. (In Windows SharePoint Services 2.0 the GetWebPartCollection method returned the collection of Web Parts on the page at the specified URL.)

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

[ObsoleteAttribute("Use SPWeb.GetLimitedWebPartManager instead.")]
public SPWebPartCollection GetWebPartCollection(
	string fullOrRelativeUrl,
	Storage storage


Type: System.String

A string that contains the absolute URL or the relative URL for the Web Part page.

Type: Microsoft.SharePoint.WebPartPages.Storage

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

Return value

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

The GetWebPartCollection method returns an ArgumentException exception if an invalid value is passed for the storage parameter. Valid values are Storage.Shared or Storage.Personal.

© 2015 Microsoft