SPList.RootFolder Property
Gets the folder that contains all the files that are used in working with the list.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
To use the RootFolder property, set the IncludeRootFolder property on the parent SPListCollection object to true.
More than RootFolder
RootFolder has much more information than one might think. For example, see how to modify the list rss settings via RootFolder:
http://novatecno.blogspot.com/2009/08/how-modify-splist-rss-programmatically.html
Edge
www.superedge.net
http://novatecno.blogspot.com/2009/08/how-modify-splist-rss-programmatically.html
Edge
www.superedge.net
- 10/13/2009
- SuperEdge
- 10/21/2009
- Thomas Lee
SPList.RootFolder = internal name of list
Note that you can use the rootfolder to get the internal name of the list, something like this extensionmethod:
public static SPList GetListByInternalName(this SPWeb web, string listInternalName)
{
var list = (from SPList l in web.Lists
where l.RootFolder.Name.Equals(listInternalName, StringComparison.InvariantCulture)
select l).FirstOrDefault();
if (list == null)
{
throw new FileNotFoundException(string.Format(
"SPList '{0}' not found on web '{1}'", listInternalName, web.Url));
}
return list;
}
- 4/20/2009
- johan leino