Partilhar via


SPWeb.GetListFromUrl Method

Gets the list that is associated with the first Web Part on the specified Web Parts page. Beginning in Windows SharePoint Services 3.0, use the GetListFromWebPartPageUrl method instead of this method.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Function GetListFromUrl ( _
    pageUrl As String _
) As SPList
'Usage
Dim instance As SPWeb
Dim pageUrl As String
Dim returnValue As SPList

returnValue = instance.GetListFromUrl(pageUrl)
public SPList GetListFromUrl(
    string pageUrl
)

Parameters

  • pageUrl
    Type: System.String

    The server-relative URL of a Web Parts page, such as /sites/sitecollection/subsite/default.aspx.

Return Value

Type: Microsoft.SharePoint.SPList
The list that is associated with the first Web Part on the specified page.

Exceptions

Exception Condition
ArgumentNullException

The pageUrl parameter is null reference.

SPException

Either the URL is invalid, or the first Web Part on the specified Web Parts page is not associated with lists.

Remarks

This method returns the list that is associated with the first Web Part on the specified Web Parts page. To return the list that is associated with the Web Parts page itself, use the GetList method.

See Also

Reference

SPWeb Class

SPWeb Members

Microsoft.SharePoint Namespace