Condividi tramite


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)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<ObsoleteAttribute("Use SPWeb.GetLimitedWebPartManager instead.")> _
Public Function GetWebPartCollection ( _
    fullOrRelativeUrl As String, _
    storage As Storage _
) As SPWebPartCollection
'Usage
Dim instance As SPWeb
Dim fullOrRelativeUrl As String
Dim storage As Storage
Dim returnValue As SPWebPartCollection

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

Parameters

  • fullOrRelativeUrl
    Type: System.String

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

Return Value

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

Remarks

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.

See Also

Reference

SPWeb Class

SPWeb Members

Microsoft.SharePoint Namespace