Esempio n. 1
0
        public bool publishWorkflowFromXml(string webUrl, string workflowXML, string workflowName, string listName)
        {
            NintexWorkflowService.NintexWorkflowWS nintexWS = new NintexWorkflowService.NintexWorkflowWS();
            nintexWS.Url = webUrl + serviceUrl;
            nintexWS.UseDefaultCredentials = true;
            bool isPublished = nintexWS.PublishFromNWFXml(workflowXML, listName, workflowName, false);

            return(isPublished);
        }
        private void DeployNintexWorkflow(ListModelHost listModelHost, NintexWorkflowDefinition workflowDefinition)
        {
            var list = listModelHost.HostList;

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model            = null,
                EventType        = ModelEventType.OnProvisioning,
                Object           = workflowDefinition,
                ObjectType       = typeof(NintexWorkflowDefinition),
                ObjectDefinition = workflowDefinition,
                ModelHost        = list
            });

            using (var nintexService = new NintexWorkflowService.NintexWorkflowWS())
            {
                nintexService.Url             = SPUrlUtility.CombineUrl(list.ParentWeb.Url, NintexUrls.WorkflowServiceUrl);
                nintexService.PreAuthenticate = true;
                nintexService.Credentials     = System.Net.CredentialCache.DefaultCredentials;

                var xmlnw = Encoding.UTF8.GetString(workflowDefinition.WorkflowXml);

                var result = nintexService.PublishFromNWFXml(xmlnw, list.Title, workflowDefinition.WorkflowName, true);
            }

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model            = null,
                EventType        = ModelEventType.OnProvisioned,
                Object           = workflowDefinition,
                ObjectType       = typeof(NintexWorkflowDefinition),
                ObjectDefinition = workflowDefinition,
                ModelHost        = list
            });
        }