/// <summary> /// Activate user solution based on workflow template information /// </summary> /// <param name="wfSolution">Encapsulates workflow solution information - package name is mandatory</param> public void ActivateWorkflowSolution(WorkflowTemplateInfo wfSolution) { // install the solution from the file url var filerelativeurl = templateLibrary.RootFolder.ServerRelativeUrl + "/" + Path.GetFileName(wfSolution.PackageFilePath); DesignPackageInfo packageInfo = new DesignPackageInfo() { PackageGuid = wfSolution.PackageGuid, PackageName = wfSolution.PackageName }; DesignPackage.Install(clientContext, clientContext.Site, packageInfo, filerelativeurl); clientContext.ExecuteQuery(); //logger.WriteMessage("Workflow solution " + Path.GetFileName(wfSolution.PackageFilePath) + " is activated."); ActivateWorkflowFeature(wfSolution.FeatureId); }
/// <summary> /// Deactivate user solution based on workflow template information /// </summary> /// <param name="wfSolution">Encapsulates workflow solution information - package guid is mandatory</param> public void DeactivateWorkflowSolution(WorkflowTemplateInfo wfSolution) { if (wfSolution.PackageGuid.Equals(Guid.Empty)) { throw new Exception("PackageGuid is not specified, please fill in."); } // uninstall the solution DesignPackageInfo packageInfo = new DesignPackageInfo() { PackageGuid = wfSolution.PackageGuid, PackageName = wfSolution.PackageName }; DesignPackage.UnInstall(clientContext, clientContext.Site, packageInfo); clientContext.ExecuteQuery(); //logger.WriteMessage("Workflow solution " + wfSolution.PackageName + " is deactivated."); }