SPUtility.GetSPListFromName Method (SPContext, SPWeb, Guid, String, String, String)
Retrieves the specified SharePoint list.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Available in SharePoint Online
Syntax
'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)> _
Public Shared Function GetSPListFromName ( _
context As SPContext, _
web As SPWeb, _
webId As Guid, _
listGuid As String, _
listUrl As String, _
listDisplayName As String _
) As SPList
'Usage
Dim context As SPContext
Dim web As SPWeb
Dim webId As Guid
Dim listGuid As String
Dim listUrl As String
Dim listDisplayName As String
Dim returnValue As SPList
returnValue = SPUtility.GetSPListFromName(context, _
web, webId, listGuid, listUrl, listDisplayName)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)]
public static SPList GetSPListFromName(
SPContext context,
SPWeb web,
Guid webId,
string listGuid,
string listUrl,
string listDisplayName
)
Parameters
context
Type: Microsoft.SharePoint.SPContextAn SPContext object that represents the context of the SharePoint Web site to which the list belongs.
web
Type: Microsoft.SharePoint.SPWebAn SPWeb object that represents the SharePoint Web site to which the list belongs.
webId
Type: System.GuidThe globally unique identifier (GUID) of the SharePoint Web site to which the list belongs.
listGuid
Type: System.StringA string that provides the globally unique identifier (GUID) of the list.
listUrl
Type: System.StringA string that provides the URL of the list.
listDisplayName
Type: System.StringA string that provides the display name of the list.
Return Value
Type: Microsoft.SharePoint.SPList
The SharePoint list associated with the provided parameters.
Remarks
This GetSPListFromName method first attempts to match the list to the specified listGuid, then the listUrl, and finally the listDisplayName.