public static bool GetList(this SPWeb web, string listTitle, out SPList list) { // find list by its title list = web.Lists.Cast<SPList>().Where(l => l.Title == listTitle).FirstOrDefault(); // if we found a list, return true return list != null; }
Usage:
SPList list; if (SPContext.Current.Web.GetList("Title of the List", out list)) { // do something with the list }
|
Zuletzt geändert am 31.12.2008 12:24 von René Hézser
|
|