Last modified at 3/15/2014 11:32 AM by Koen Zomers

‚ÄčAt a customer site where they are still using SharePoint 2007, I was facing the situation with many exceptions being logged in the Event Viewer regarding list retrieval in custom code from lists that did not appear to actually exist. With a pro SharePoint 2010 mind I right-a-way wanted to adjust the code to use SPList.TryGetList. Soon I found out that this has been added in SharePoint 2010 and is not available yet in SharePoint 2007. A Bing search lead me to a blogpost with the following great alternative which utilized Lync to check if the SPList exists: 

SPList myList = web.Lists.Cast<SPList>().FirstOrDefault(l => l.Title == "Shared Documents");

Thanks to R Manimaran for sharing this wisdom!