Delete File

Use this step to delete a file from the OneDrive folder.

Last published at: September 9th, 2025

oneDriveDeleteFile Step

Description:

The Delete File workflow step deletes a specified file in OneDrive using the selected OAuth provider. The step accepts a path to the file to delete and provides a Variable or Global variable to store the operation result.

The step supports:

  • Selecting an OAuth provider for the OneDrive operation.
  • Specifying the path of the file to delete.
  • Storing the operation result in a Variable or Global variable.
  • Returning a True or False result for subsequent workflow processing.

 

Inputs

  • Select OAuth provider - Specifies the OAuth provider to use for the OneDrive operation.
  • Path to delete file - Specifies the path of the OneDrive file to delete.
  • Store result in Variable/Global - Specifies the Variable or Global variable in which the operation result is stored.
 

 

Returns

  • True – The True return path can be connected to the next workflow activity when the delete-file operation completes successfully.
  • False – The False return path can be used for error handling or an alternative workflow path when the operation does not succeed. 
 

 

Usage:

Place the Delete File step after a workflow has determined that a particular OneDrive file is no longer required.

The workflow supplies the OAuth provider and file path, performs the delete operation, and stores the resulting information in the specified Variable or Global variable.

A typical workflow pattern is:

Determine File → Delete File → Use Result

The result can then be used by subsequent workflow activities to:

  • Continue processing after a successful deletion.
  • Route the workflow to an alternative path.
  • Perform cleanup activities.
  • Record or process the operation result.
  • Trigger error-handling logic.
  • Complete a document-management workflow.

 

 

To use this step, you must configure OneDrive in FlowWright.

 

The Windows Live OAuth configuration is included here for reference. 

 

Typical Workflow Suggestions:

Delete Temporary OneDrive Files

Use this step to remove files created or uploaded temporarily during workflow execution.

Example:

Create Temporary File → Process File → Delete File → Complete Workflow

This can help keep temporary files from accumulating in a OneDrive location.

 

Clean Up After Document Processing

Use the step after a file has been downloaded, processed, converted, or otherwise handled.

Example:

Download File → Process Document → Delete File → Continue

The delete operation can serve as the cleanup stage after the workflow has finished using the source file.

 

Delete Files After Archiving

Use the step after a required file has been copied or archived to its final destination.

Example:

Retrieve File → Archive File → Delete File → Complete

This provides a straightforward cleanup pattern for workflows that move content from a working location to an archive.

 

Clean Up Export Files

Use the step to remove temporary export files after they have been delivered to their intended destination.

Example:

Generate Export → Send/Upload Export → Delete File → Complete

This can be useful when an intermediate OneDrive file is needed only for the duration of a workflow.

 

Remove Files After Approval Processing

Use the step after a document-related approval workflow has completed and the temporary source file is no longer needed.

Example:

Approval → Finalize Document → Delete File → Notify User

This can help keep working locations clean after the approval process finishes.

 

Clean Up Canceled Workflows

Use the step on a cancellation path to remove temporary files associated with an abandoned workflow.

Example:

Process Canceled → Delete File → Record Cancellation

The surrounding workflow should determine which file to remove before invoking the step.

 

Perform File Housekeeping

Use the step in a workflow that performs document-management housekeeping.

Example:

Identify File for Cleanup → Delete File → Record Result

The XML defines the file path as a required input, but does not define how files should be selected for cleanup. The surrounding workflow should implement that selection logic.

 

Delete Multiple Files Sequentially

Use multiple instances of the step when a workflow needs to remove several known files.

Example:

Delete File A → Delete File B → Delete File C → Complete

Each step can be configured with its own file path and result destination.

 

Route the Workflow Based on the Delete Result

Use the True and False return paths to distinguish the subsequent workflow path.

Example:

Delete File
True → Continue Workflow
False → Error Handling

The step definition provides two outgoing connections and explicitly defines True and False return values.

 

Store the Operation Result for Later Use

Use the resultJson property to retain the operation result in a Variable or Global variable.

Example:

Delete File → Store Result → Process Result

The result destination is a required string property specifically labeled “Store result in Variable/Global.”

 

Use Dynamic File Paths

Construct the file path from workflow values when the same workflow handles different files.

Example:

Build File Path → Delete File → Continue

The Path to delete file property is a string, so the workflow can provide the configured path value appropriate to the process.

 

Clean Up Files After OneDrive Processing

Use the step at the end of a sequence of OneDrive-related operations.

Example:

Get File → Process File → Upload Final Version → Delete File → Complete

This pattern is useful when a file serves as an intermediate working copy.

 

Separate Normal and Exception Processing

Connect the True and False paths to different activities so unsuccessful deletion doesn't automatically follow the normal completion path.

Example:

Delete File → True → Complete
Delete File → False → Log/Handle Error

This makes the cleanup outcome explicit within the workflow.

 

Example:

Let’s build and execute the “oneDriveDeleteFileDef” example.          

  • Create a new process definition called “oneDriveDeleteFileDef” and open it in Designer mode.
  • Drag a “oneDriveDeleteFile” step to the canvas. 
  • Connect the dots between the Start and “oneDriveDeleteFile” steps, as shown above. 
  • Select the line between the steps to configure the “Connection Properties”. The default property values are “None, True, False, Error, and Evaluate”. Depending on the step’s purpose, you can configure additional values.
  • Define a variable or a global to store the result. 
  • Click the “OneDriveDeleteFile” step to configure its “Required” properties. Provide a name for the step. Select the OAuth Windows Live provider. Provide the file path to delete on the application server. Provide a variable or a global reference to store the result. Click the Save button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description. 

 

  • The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. Configure the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

 

  • Save the process definition, create a new instance, and execute it. Render the process instance and click the Delete File process step to view its properties. When the workflow reaches the Delete File step, FlowWright uses the selected OAuth provider and configured file path for the OneDrive operation. The operation result is stored in the configured Variable or Global variable. Inspect the stored result and the workflow's True or False path to verify the outcome.

 

Tips:

  • Select the appropriate OAuth provider before executing the step.
  • Carefully verify the OneDrive file path before running the workflow.
  • Make sure the configured path identifies the intended file.
  • Use a meaningful Variable or Global variable name for the stored result.
  • Test the workflow with a representative file before deploying it to production.
  • Consider using the True path for normal continuation after successful processing.
  • Connect the False path to appropriate error-handling or recovery logic.
  • When constructing file paths dynamically, verify the resulting value before the Delete File step executes.
  • Avoid hard-coding environment-specific paths when the workflow will be deployed across multiple environments.
  • Place cleanup after all required file processing has completed.
  • If a file is required for auditing, reporting, or subsequent processing, do not delete it until those activities have finished.
  • Test cancellation paths separately when the step is being used for workflow cleanup.
  • When deleting files as part of a larger document lifecycle, verify that the preceding workflow logic has identified the correct file.
  • Do not assume how a nonexistent file, invalid path, access failure, or other OneDrive condition is represented by the True or False result unless confirmed by the FlowWright implementation.
  • Do not assume that the resultJson property necessarily indicates a particular JSON structure without inspecting the actual implementation result.
  • Keep OAuth configuration and permissions appropriate for the OneDrive operation.
  • Avoid exposing sensitive information contained in the stored operation result to users or external systems.

 

Notes:

  • The Delete File step is defined in the OneDrive category with the internal name onedrivedeletefile, label “Delete file in One Drive”, and display name “Delete File.”
  • The step is implemented by FlowWright.Workflow.OneDriveDeleteFile in FlowWright.Workflow.dll and is defined as a Process step with 2 incoming connections and 2 outgoing connections.
  • The step defines three required properties:
    • selOAuthProvider – Select OAuth provider
    • destinationFilePath – Path to delete file
    • resultJson – Store result in Variable/Global 
  • The OAuth provider property uses the SelOAuthProvider data type, implemented by FlowWright.DataTypes.SelOAuthProvider in FlowWright.DataTypes.dll. Its description is “Get oAuth provider list.”
  • The file-path and result-destination properties use the string data type, implemented by FlowWright.DataTypes.ClsTextBox in FlowWright.DataTypes.dll.
  • The step provides two return values:
    • False
    • True

 

Definition Sample:

You may download the sample definition(s) from the link provided and later import them into your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.

Note: Verify and complete any missing configuration after importing the sample, including:

  • OAuth provider.
  • OneDrive file path.
  • Variable or Global variable used to store the result.
  • Workflow Variable references.
  • Environment-specific OAuth settings.
  • OneDrive permissions.
  • Downstream True and False workflow paths.
  • Any preceding logic that determines whether the file should be deleted.

After verifying the configuration, save the Process Definition before execution.

Click here to download the sample file.