Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

web.GetList("Lists/TestList") throws FileNotFound exception

$
0
0

I have the following code in my application. It is throwing FileNotFound exception at web.GetList("Lists/TestList") line. This list exists and I am able to get the list from web.Lists.TryGetList("TestList"). But I am getting exception when I am trying to get the list from the relative URL. Can anyone please help me?

 string siteUrl = "<siteURL>";

                using (SPSite site = new SPSite(siteUrl))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList list = web.GetList("/Lists/TestList");
                    }
                }


Ven


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>