Before using an SPList we need to check whether that specific list name exists in the web or site. To do this use this method in C#:
public static bool ListExists(SPWeb web, string listName) { return web.Lists.Cast<SPList>().Any(list => string.Equals(list.Title, listName)); }
(Visited 505 times, 1 visits today)