Returns the list that is associated with the specified server-relative URL.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration Public Function GetList ( _ strUrl As String _ ) As SPList 'Usage Dim instance As SPWeb Dim strUrl As String Dim returnValue As SPList returnValue = instance.GetList(strUrl)
- Type: System.String
A string that contains the server-relative URL for a list, for example, /sites/MySiteCollection/Lists/Announcements.
When you call the GetList method using the full URL for a list that does not exist, a FileNotFoundException is thrown and the value of the AllowUnsafeUpdates property changes to false.
Use the GetListFromWebPartPageUrl method to return the list that is associated with the first Web Part in a Web Part page.