pdanan

See also: Other Geeks@INDC

Better way to get List Object in Sharepoint 2010

In Sharepoint 2010, there is new method to get List object, that is TryGetList. With TryGetList you don't bother to "try catch" to check the existence.

Sample :

SPList mylist = web.Lists.TryGetList("shared documents");

if (mylist != null)

{

    MessageBox.Show(mylist.Title + " is exist");

}

Reference:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistcollection.trygetlist.aspx

Share this post: | | | |

Comments

No Comments