public string Export(string url, Workflow workflow, string path) { var nintexService = new NintexWorkflowWS { Url = string.Concat(url, NintexServiceUrl), Credentials = CredentialCache.DefaultCredentials }; if (!SpContext.IsFeatureActivated(url, NintexWorkflowFeatureId)) { throw new Exception(string.Format("Web feature \"Nintex Workflow 2010\" is not activated for the site {0}. Please activate and try again.", url)); } var workflowXml = nintexService.ExportWorkflow(workflow.Name, workflow.ListName, workflow.Category); var localFilePath = SaveWorkflowXmlToFile(workflow.Name, workflowXml, path); workflow.Serialize(localFilePath); return(localFilePath); }
public void Import(string url, string workflowFile, string metadatafile) { var nintexService = new NintexWorkflowWS { Url = string.Concat(url, NintexServiceUrl), Credentials = CredentialCache.DefaultCredentials }; if (!SpContext.IsFeatureActivated(url, NintexWorkflowFeatureId)) { throw new Exception(string.Format("Web feature \"Nintex Workflow 2010\" is not activated for the site {0}. Please activate and try again.", url)); } var workflow = Workflow.Deserialize(metadatafile); var workflowBytes = File.ReadAllBytes(workflowFile); nintexService.PublishFromNWF(workflowBytes, workflow.Category.ToLower().Equals("list") ? workflow.ListName : null, workflow.Name, true); System.Windows.MessageBox.Show("Successfully imported workflow"); }