Mr. Lou Sanderson

I'm part of a team that is implementing MOSS for a large organization. We are 
planning a site collection that would house a large number of sub sites. It 
would be nice to have a list that dynamically shows all of the sub sites - I 
know a table of contents web part gives me this information, but I also want 
to include some metadata (name of subsite, description of subsite, and 
category of subsite) in my list which the TOC WP wont do. 

Does anyone know how I could make a list that would automatically grow when 
a subsite is created, automatically shrink when a subsite is deleted, and 
could accomodate metadata 

Thanks,
Lou Sanderson


Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

Gary A. Bushey

There is no list that handles this out of the box that I know of.




Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

HsuGotaQ

Here is some code to help you out (will need to create a webpart to display the information):

foreach(SPWeb web in SPContext.Current.Site.AllWebs)
{

/*

Display information here where:

  • SPWeb.title - The title of the subsite
  • SPWeb.description - The description of the subsite
  • SPWeb.url - The URL of the subsite

*/

}

In this case, the webpart would display every subsite under the current site which the user has access to.






Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

Lou Sanderson

great!

but...

now how do i go about creating a webpart

can i do it in designer or do i need visual studio





Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

HsuGotaQ

You will need visual studio to develop web parts.






Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

Lou Sanderson

gracias!



Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

Hardeep Singh

Well, you can use the Site Directory template to create master site list which gets populated automatically when you create a subsite. Once configured you can create the views on this master site list. Follow these steps:

1. Create a subsite using Site Directory template

2. Edit the main page to create categories (META DATA) for sites

3. Go to Centeral Admin > Operations > Master Site Directory Settings and add the link to the site directory page. Make sure the checkbox "Enforce Listing new sites in Site Directory" is checked.

4. Once you do that every new site will be listed under site directrory list.

<Hardeep />





Re: SharePoint - General Question and Answers and Discussion MOSS dynamic list

Muhammad Masood

Hi HsuGotaQ,

I have also needed this webpart... and I developed it using above code.

It works fine... but one issue is that it lists all subsites but not list sites under specified site.

The modified version of the above code is:

SPWeb _site = new SPSite(http://myportal-server:1234/SiteDirectory);

_allWebs = _site.AllWebs;

foreach(SPWeb _web in _allWebs)

{

/*

my code is here...

*/

}

the above code list all sites not under the specified site directory.

NOTE: The above URL can be local or other portal server as well.

Any help please....

Thanks.