The list "Region" exists at the parent web but the following code throws error. Is there anything else or other way I could reference a list that is on parent site?
SPList regionList = web.ParentWeb.GetList("Region");
|
The list "Region" exists at the parent web but the following code throws error. Is there anything else or other way I could reference a list that is on parent site?
|
|||
|
|
|
The
So in your case, you may want to change your code snippet like the following:
|
|||
|
|
|
I believe the SPWeb.GetList method uses a server-relative URL to get the list see here (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getlist.aspx). You could add a using statement for the web and then get the list by it's name from the SPWeb.Lists collection:
Thanks, Alex |
|||
|
|