Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

stsadm & Site Directory

  Asked By: Ervin Pickett         Date: May 08, 2005      Category: Sharepoint      Views: 220
 

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
directory?

Tagged:      

 

3 Answers Found

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

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, 2005       

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;
break;
}
}
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);
itm.Update();
}
}

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

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.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].