Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

stsadm & Site Directory

  Asked By: Ervin    Date: May 08    Category: Sharepoint    Views: 1466

I need to move some sites from one portal to another.
Stsadm works great for this, but the sites do not get added to the site
directory unless I go in and add each one manually.
Is there a way to programatically have these sites added to the site



3 Answers Found

Answer #1    Answered By: M Juarez     Answered On: May 08

yeah.. also to the search site  directory.. ive learned to accept microsofts 70% solution..

has anyone got a simple way to accomplish that?

sharing the pain,

Answer #2    Answered By: Marty Mcdowell     Answered On: May 08

Yes you can do it using SharePoint OM. I have done it before. I don't if this will help but here is part of my code.

private void FillInSiteColumns()
bool created = true;
SPWeb siteDirectoryArea = null;
string site  = SiteURLBox.Text.Substring(0, SiteURLBox.Text.LastIndexOf('/')-1);
SPList siteDirectoryList;
SPSite portalSite = new SPSite(site);
siteDirectoryArea = portalSite.AllWebs["SiteDirectory"];
siteDirectoryArea.AllowUnsafeUpdates = true;
siteDirectoryList = siteDirectoryArea.Lists["Sites"];
SPListItemCollection listItems = siteDirectoryList.Items;
foreach(SPListItem item in listItems)
if (item["SiteTitle"].Equals(SiteTitleBox.Text))
created = false;
if (created == true)
SPListItem itm = listItems.Add();
itm = siteDirectoryList.Items.Add();
itm["SiteTitle"] = SiteTitleBox.Text;
itm["SiteURL"] = SiteURLBox.Text;
itm["Col 1"] = FillInColVal(one);
itm["Col 2"] = FillInColVal(two);
itm["Col 3"] = FillInColVal(three);
itm["Col 4"] = FillInColVal(four);

Answer #3    Answered By: Dakota Shaffer     Answered On: May 08

Likewise the Lists web service is relatively easy to use and will let you add  items to the Site Directory List.

Didn't find what you were looking for? Find more on stsadm & Site Directory Or get search suggestion and latest updates.