コード例 #1
0
        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");
        }