GetSPListFromName method (SPWeb, Guid, String, String, String)
Collapse the table of content
Expand the table of content

SPUtility.GetSPListFromName method (SPWeb, Guid, String, String, String)

Retrieves the specified SharePoint list without specifying the associated SPContext object.

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

public static SPList GetSPListFromName(
	SPWeb web,
	Guid webId,
	string listGuid,
	string listUrl,
	string listDisplayName
)

Parameters

web
Type: Microsoft.SharePoint.SPWeb

An SPWeb object that represents the SharePoint Web site to which the list belongs.

webId
Type: System.Guid

The globally unique identifier (GUID) of the SharePoint Web site to which the list belongs.

listGuid
Type: System.String

A string that provides the globally unique identifier (GUID) of the list.

listUrl
Type: System.String

A string that provides the URL of the list.

listDisplayName
Type: System.String

A string that provides the display name of the list.

Return value

Type: Microsoft.SharePoint.SPList
The SharePoint list associated with the provided parameters. If the list does not exist or cannot be found using the supplied parameters, the method returns a null reference (Nothing in Visual Basic).

One or more parameters of the GetSPListFromName method can be null or empty strings. The method first tests the values of the webId and listGuid parameters. If those values are null or empty, the method tests the value specified in the listUrl parameter. If that value is null or empty, the method uses the value in the listDisplayName parameter as a last resort.

Show:
© 2016 Microsoft