AnsweredAssumed Answered

How to export the Nintex Workflow (.nwf) from sharepoint using c# ?

Question asked by piyush.bitscape on Aug 8, 2017

Hi All

 

As one of my client  have requirement that he can  Export all the nintex Workflow and Form from the his site using PowerShell from SP2013 environment

 

For that I have Create Command Called  Export-NW  and did code in the c# as command backend logic.

 

I have used following method from Nintex.

 

workflowService1.ExportWorkflow(association.Name ,list.Title, "SPWorkflowAssociation"); method is throwing error that

SPWorkflowAssociation is invalide term

 

so please help me if any have solution for same

 

it is bit urgent

 

Thank You in advance

 

 private void ProcessNintexWorkflow(SPList list, SPWeb web)
        {
            list = web.Lists.TryGetList("Document Types");
            var associateWorkflow = list.WorkflowAssociations;
          
            NintexWorkflowService.NintexWorkflowWS workflowService1 = new NintexWorkflowService.NintexWorkflowWS();
            workflowService1.Url = SPUrlUtility.CombineUrl(web.Url, nintexServiceUrl);
            workflowService1.Credentials = System.Net.CredentialCache.DefaultCredentials;
            foreach (SPWorkflowAssociation association in associateWorkflow)
            {
              //  string s = associateWorkflow.GetType().Assembly.FullName;
                Console.WriteLine(association.Name.ToString());
                    workflowService1.ExportWorkflow(association.Name ,list.Title, "SPWorkflowAssociation");
            }

            #endregion
        }
            

Outcomes