Beispiel #1
0
        public void ScheduleWorkflow(string webUrl, string workflowName, string startData, int maximumRepeats, bool workdaysOnly, string endOn, DateTime startTime, DateTime endTime, int countBetweenIntervals, string repeatType)
        {
            NintexWorkflowService.NintexWorkflowWS nintexWS = new NintexWorkflowService.NintexWorkflowWS();
            nintexWS.Url = webUrl + serviceUrl;
            nintexWS.UseDefaultCredentials = true;
            NintexWorkflowService.Schedule           schedule         = new NintexWorkflowService.Schedule();
            NintexWorkflowService.RepeatIntervalType nintexRepeatType = new NintexWorkflowService.RepeatIntervalType();
            NintexWorkflowService.EndScheduleOn      nintexEndOn      = new NintexWorkflowService.EndScheduleOn();
            NintexWorkflowService.RepeatInterval     repeatInterval   = new NintexWorkflowService.RepeatInterval();

            Enum.TryParse(repeatType, out nintexRepeatType);
            Enum.TryParse(endOn, out nintexEndOn);

            repeatInterval.CountBetweenIntervals = countBetweenIntervals;

            repeatInterval.Type     = nintexRepeatType;
            schedule.EndOn          = nintexEndOn;
            schedule.RepeatInterval = repeatInterval;
            schedule.StartTime      = startTime;
            schedule.EndTime        = endTime;
            schedule.WorkdaysOnly   = workdaysOnly;
            schedule.MaximumRepeats = maximumRepeats;


            nintexWS.AddWorkflowSchedule(null, workflowName, startData, schedule, true);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public string getWorkflowXML(string webUrl, string workflowName, string listName, WorkflowType workflowType)
        {
            string workflowXML = string.Empty;

            NintexWorkflowService.NintexWorkflowWS nintexWS = new NintexWorkflowService.NintexWorkflowWS();
            nintexWS.Url = webUrl + serviceUrl;
            Console.WriteLine("Getting workflow from " + webUrl + serviceUrl);
            nintexWS.UseDefaultCredentials = true;
            workflowXML = nintexWS.ExportWorkflow(workflowName, listName, workflowType.ToString());
            return(workflowXML);
        }
Beispiel #4
0
        public Stream getWorkflowXMStream(string webUrl, string workflowName, string listName, WorkflowType workflowType)
        {
            string workflowXML = string.Empty;

            NintexWorkflowService.NintexWorkflowWS nintexWS = new NintexWorkflowService.NintexWorkflowWS();
            nintexWS.Url = webUrl + serviceUrl;
            nintexWS.UseDefaultCredentials = true;
            workflowXML = nintexWS.ExportWorkflow(workflowName, listName, workflowType.ToString());
            var stream = new MemoryStream();
            var writer = new StreamWriter(stream);

            writer.Write(workflowXML);
            writer.Flush();
            stream.Position = 0;
            return(stream);
        }
        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
            });
        }