Home >

List Not Found exception by using .RootFolder.Name Property in SharePoint

3. March 2011

In SharePoint, if you use .RootFolder.Name property as shown below:

   1: string rootFolderName = objSPWeb.Lists[strListGuid].RootFolder.Name;

You might get exception on this IFF user changed that list name/title under question. Actually, RootFolder.Name doesn’t get changed once list is created. So, to make code flawless, you should use Title property of the list as shown below:

   1: string rootFolderName = objSPWeb.Lists[strListGuid].Title;

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading