Thursday, September 23, 2010

subsites in sharepoint

this code snippet retrieving all sub sites from the root site in Share point Server 2007

SPSite site = new SPSite("http://win-j40e6cmrcl9/personal/administrator/");
string[] subsites = site.AllWebs.Names;
for (int i = 0; i < subsites.Length; i++)
{
SPWeb web = site.AllWebs[i];
Response.Write(web.Name.ToString());

}

Tuesday, September 21, 2010

Site deleting in sharepoint server

Deleting the site from the share point server can be done via STSADM.EXE and through the central administration.

switch command prompt

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN\STSADM -o deletesite -url http://localhost/sites/Murugesan




Through Central Administration,

Click on Application Management and Delete Site collection,choose the site name under the web application.


Wednesday, September 15, 2010

Site backup in Moss 2007


Site backup in moss 2007 is not an rocket science anymore.
Download the tool Smigrate.exe from the Microsoft site.
extract under the Bin folder of the 12 hive.

pass the command
sMigrate.exe -w http://localhost/sites/Murugesan -f Murugesan1.fwp -u administrator -pw your password

Yes ! look at the command window for the status of the given command.

Friday, September 10, 2010

Listing all webpages from moss site

Listing the all the webpages from the site in MOSS 2007/sharepoint service
I used to itereate the file names using the Sharepoint Object Model's SPListItems

SPSite mySite = new SPSite("http://localhost/MurugesanSite/");
SPWeb myWeb = mySite.OpenWeb();
SPList NoOfPages= myWeb.Lists[2];
foreach(SPListItem items in NoOfPages.Items)
{
Response.Write(items.File.ToString());
}

}