This topic has not yet been rated - Rate this topic

SPList.RootFolder Property

Windows SharePoint Services 3
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)
public SPFolder RootFolder { get; }

Property Value

An SPFolder object that represents the root folder.

To use the RootFolder property, set the IncludeRootFolder property on the parent SPListCollection object to true.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
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
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;
}
Corresponding SPListItem object

Note, that folder returned by SPList.RootFolder does not have corresponding SPListItem object.

So, SPListObject.RootFolder.Item will return null.