/// <summary> /// Exports site. Called when the "Export site" button is pressed. /// Expects the ImportSite method to be run first. /// </summary> private bool ExportSite() { // Delete temporary data try { ExportProvider.DeleteTemporaryFiles(); } catch { } // Prepare the properties string websitePath = Server.MapPath("~/"); string exportFileName = string.Format("APIExample_Site_{0:yyyy-MM-dd_hh-mm}.zip", DateTime.Now); string exportFilePath = FileHelper.GetFullFolderPhysicalPath(ImportExportHelper.GetSiteUtilsFolder(), websitePath) + "Export\\" + exportFileName; string siteName = "MyNewImportedSite"; // Ensure that site exists if (SiteInfoProvider.GetSiteInfo(siteName) != null) { // Ensure there is no exported package with the same name if (!File.Exists(exportFilePath)) { // Export ExportProvider.ExportSite(siteName, exportFilePath, websitePath, false, MembershipContext.AuthenticatedUser); return(true); } } return(false); }