Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent: Get lists of Folder from which we cannot create subsite 1

Status
Not open for further replies.

progpradip

Programmer
Nov 26, 2008
23
In Sharepoint, there are the no. of names from which we cannot create the subsites under a site. Like 'images', 'lists' etc. From Sharepoint manager, we can view these names (there are such folders: 'images', 'lists' etc) which is located in the Folder named 'RootFolder'.
Does anybody know how to extract those names in C#?
 
Hello,

Certainly, try this:

using (SPSite site = new SPSite("[YOUR SITE]"))
{
using (SPWeb web = site.OpenWeb())
{
foreach (SPFolder folder in web.RootFolder.SubFolders)
{
Console.WriteLine(folder.Name);
}
Console.ReadLine();

}
}

.b

Blog for my upcoming SharePoint book
"Building the SharePoint User Experience":
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top