Delete web site

The following example shows how you can delete an existing web site:

 

[C#]

 

using CMS.SiteProvider;

using CMS.CMSHelper;

using CMS.WorkflowEngine;

 

...

 

           // Code name of the site

           string siteName = "mysitecodename";

 

           // Delete records in CMS_Tree and CMS_Document

           DocumentHelper.DeleteSiteTree(siteName, null);

 

           // Delete other dependencies and the site

           SiteInfoProvider.DeleteSite(siteName);

 

           lblInfo.Text = string.Format("Site '{0}' has been deleted.", siteName);