The SharePoint Coffee House
I'd like some SharePoint with my coffee please...

2010 Helpful Tip - SPListCollection.TryGetList Method

Friday, 2 July 2010 14:13 by Michael Mukalian

Remember when (days long ago...) you tried to instantiate to a list in SharePoint via either SPWeb.Lists["List Name"] or SPWeb.GetList("list URL"), you'd not know if the list was truly there until your code went along it's merry way, or it exceptioned out?  Well here comes SPListCollection.TryGetList().  Passing in the title of the list will either return the SPList itself or null.  At this point you can then do a null check and address it accordingly, instead of relying on an exception.

Something a little cool I just came across... - M

SPListCollection.TryGetList Method

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   2010 | Development
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Comments

Comments are closed