/// <summary> /// Exports user object. Called when the "Export object" button is pressed. /// Expects the ImportUser method to be run first. /// </summary> private bool ExportObject() { // Delete temporary data try { ExportProvider.DeleteTemporaryFiles(); } catch { } // Get user UserInfo exportedUser = UserInfoProvider.GetUserInfo("MyNewImportedUser"); // Ensure that user exists if (exportedUser != null) { // Prepare the properties string websitePath = Server.MapPath("~/"); string exportFileName = string.Format("APIExample_User_{0:yyyy-MM-dd_hh-mm}.zip", DateTime.Now); string exportFilePath = FileHelper.GetFullFilePhysicalPath(ImportExportHelper.GetSiteUtilsFolder(), websitePath) + "Export\\" + exportFileName; // Ensure there is no exported package with the same name if (!File.Exists(exportFilePath)) { // Export ExportProvider.ExportObject(exportedUser, exportFilePath, websitePath, MembershipContext.AuthenticatedUser); return(true); } } return(false); }