SaveFromNWF
Save or update a workflow from the contents of a Nintex Workflow workflow (.nwf) file, specified as a byte array.
Syntax
public WorkflowMetaData SaveFromNWF( byte[] workflowFile, string listName, string workflowName )
Parameters
- workflowFile
- Type: System.Byte
Optional. A Base64-encoded byte array, representing the contents of a Nintex Workflow workflow (.nwf) file.
- listName
- Type: System.String
Optional. The name of a SharePoint list. If a value is not specified, the workflow is saved as a site workflow; otherwise, the workflow is saved to the specified list as a list workflow.
- workflowName
- Type: System.String
Optional. The name of the workflow to be saved. If a value is not specified, the name specified in the contents of the Nintex Workflow 2013 export (.nwp) file is used; otherwise, the specified name is used.
Returns
Type: WorkflowMetaData
Metadata about the saved or updated workflow.
Remarks
A Nintex Workflow 2013 export (.nwf) file is an XML file created by exporting an existing workflow from the Nintex Workflow designer. For more information about export files, see Export files.
This method cannot convert list workflows to site workflows, or site workflows to list workflows. If the export file contains the definition for a reusable or list workflow, you must save it to a SharePoint list. If the export file contains the definition for a site workflow, you must save it to a SharePoint site. Otherwise, an error occurs.
If a workflow with the same name already exists, this method overwrites the existing workflow and updates version-specific workflow metadata accordingly. If you do not want to overwrite an existing workflow, use the SaveFromNWFXmlNoOverwrite method.
This method saves, but does not publish, a workflow. To publish a workflow directly from the XML contents of a export file, you can use the PublishFromNWF method, or any of the related methods.
Example: Saving a new workflow
The following example demonstrates how to use this operation to save a workflow from the contents of a export file.
Request
The following SOAP request attempts to save a new workflow named SavedWorkflow, defined from the contents of a export file, to the TestContacts2 list.
Note: A portion of the value for the workflowFile element has been removed for readability.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:nin="http://nintex.com"> <soap:Header/> <soap:Body> <nin:SaveFromNWF> <nin:workflowFile> PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48RXhwb3J0ZWRXb3JrZmxvd1dp dGhMaXN0TWV0ZGF0YSB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1h ... cnRlZFdvcmtmbG93V2l0aExpc3RNZXRkYXRhPg== </nin:workflowFile> <nin:listName>TestContacts2</nin:listName> <nin:workflowName>SavedWorkflow</nin:workflowName> </nin:SaveFromNWF> </soap:Body> </soap:Envelope>
Response
The following SOAP response indicates that the list workflow was successfully saved, and provides metadata about the saved workflow.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <SaveFromNWFResponse xmlns="http://nintex.com"> <SaveFromNWFResult> <Name>SavedWorkflow</Name> <ModifiedBy>TestUser</ModifiedBy> <WorkflowDescription/> <EcbId>b4febab5-2c8a-41a7-894b-b0d3ab4469ef</EcbId> <Published>0001-01-01T00:00:00</Published> <LocalTimePublishedString>12/30/1899 11:00 AM</LocalTimePublishedString> <TimeLastModified>2015-01-26T16:27:23Z</TimeLastModified> <LocalTimeLastModifiedString>1/27/2015 3:27 AM</LocalTimeLastModifiedString> <ChangeInformation/> <WorkflowId>49bb1711-07f0-40ea-a1a5-d5556caa7973</WorkflowId> <WorkflowTypeDisplayName>List workflow</WorkflowTypeDisplayName> <UIVersion>0.1</UIVersion> <IsPublished>false</IsPublished> <PreviouslyPublished>false</PreviouslyPublished> <ListId>a70e0491-1b11-4277-ab30-8241aba19b6b</ListId> <MajorVersion>0</MajorVersion> <MinorVersion>1</MinorVersion> <Notifications/> </SaveFromNWFResult> </SaveFromNWFResponse> </soap:Body> </soap:Envelope>
Example: Updating an existing workflow
The following example demonstrates how to use this operation to update an existing workflow from the contents of a export file.
The example assumes that the previous example, in Example: Saving a new workflow, was executed, and that this example updates the workflow saved in the previous example.
Request
The following SOAP request attempts to update an existing list workflow named SavedWorkflow, defined from the contents of a export file, to the TestContacts2 list.
Note: A portion of the value for the workflowFile element has been removed for readability.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:nin="http://nintex.com"> <soap:Header/> <soap:Body> <nin:SaveFromNWF> <nin:workflowFile> PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48RXhwb3J0ZWRXb3JrZmxvd1dp dGhMaXN0TWV0ZGF0YSB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1h ... cnRlZFdvcmtmbG93V2l0aExpc3RNZXRkYXRhPg== </nin:workflowFile> <nin:listName>TestContacts2</nin:listName> <nin:workflowName>SavedWorkflow</nin:workflowName> </nin:SaveFromNWF> </soap:Body> </soap:Envelope>
Response
The following SOAP response indicates that the existing workflow was successfully updated, and provides metadata about the updated workflow. The version-specific metadata for the updated workflow, such as the UIVersion and MinorVersion elements, are updated accordingly.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <SaveFromNWFResponse xmlns="http://nintex.com"> <SaveFromNWFResult> <Name>SavedWorkflow</Name> <ModifiedBy>TestUser</ModifiedBy> <WorkflowDescription/> <EcbId>b4febab5-2c8a-41a7-894b-b0d3ab4469ef</EcbId> <Published>0001-01-01T00:00:00</Published> <LocalTimePublishedString>12/30/1899 11:00 AM</LocalTimePublishedString> <TimeLastModified>2015-01-26T16:31:39Z</TimeLastModified> <LocalTimeLastModifiedString>1/27/2015 3:31 AM</LocalTimeLastModifiedString> <ChangeInformation/> <WorkflowId>49bb1711-07f0-40ea-a1a5-d5556caa7973</WorkflowId> <WorkflowTypeDisplayName>List workflow</WorkflowTypeDisplayName> <UIVersion>0.2</UIVersion> <IsPublished>false</IsPublished> <PreviouslyPublished>false</PreviouslyPublished> <ListId>a70e0491-1b11-4277-ab30-8241aba19b6b</ListId> <MajorVersion>0</MajorVersion> <MinorVersion>2</MinorVersion> <Notifications/> </SaveFromNWFResult> </SaveFromNWFResponse> </soap:Body> </soap:Envelope>
See Also
Concepts
Operations
Exporting and importing workflows