private static HotDocs.Sdk.Template OpenTemplate(string packageId) { //Note that in this sample portal, the package ID is used to construct the package file name, but this does not need to be the case. string packagePath = PackageCache.GetLocalPackagePath(packageId); if (!File.Exists(packagePath)) { throw new Exception("The template does not exist."); } HotDocs.Sdk.PackagePathTemplateLocation location = new HotDocs.Sdk.PackagePathTemplateLocation(packageId, packagePath); return(new HotDocs.Sdk.Template(location)); }
/// <summary> /// This method deletes a template package and its corresponding manifest file from the Templates folder. /// </summary> /// <param name="packageID">The ID of the template package to delete.</param> public static void DeleteTemplatePackage(string packageID) { string packagePath = PackageCache.GetLocalPackagePath(packageID); //Clean up any extracted files. HotDocs.Sdk.PackagePathTemplateLocation location = new HotDocs.Sdk.PackagePathTemplateLocation(packageID, packagePath); location.CleanPackageFiles(); // Delete the package file. if (File.Exists(packagePath)) { File.Delete(packagePath); } // Delete the manifest file. string manifestPath = System.IO.Path.ChangeExtension(packagePath, ".xml"); if (File.Exists(manifestPath)) { File.Delete(manifestPath); } }