spDeleteFolder Step

Use this feature to delete a folder from a SharePoint site using the configured SharePoint site URL, OAuth provider, and folder path.

Last published at: August 31st, 2026

Description:

The Delete Folder workflow step deletes a specified folder from a SharePoint site.

The step uses the configured SharePoint site Base URL and OAuth provider to access SharePoint, identifies the folder using its destination path, and stores the operation result in a FlowWright Variable or Global variable.

The step supports:

  • Deleting a folder from a SharePoint site.
  • Configuring the SharePoint site Base URL.
  • Selecting an OAuth provider.
  • Specifying the path of the folder to delete.
  • Storing the operation result in a Variable or Global variable.
  • Returning a success or failure result.

This step can be used for:

  • Removing temporary SharePoint folders.
  • Cleaning up folders created during workflow execution.
  • Deleting obsolete project or case folders.
  • Removing folders as part of document-retention processes.
  • Cleaning up after workflow completion.
  • Automating SharePoint repository maintenance.
  • Integrating SharePoint folder management into FlowWright workflows.

 

Inputs

  • BaseURL – The BaseURL for your SharePoint site property specifies the Base URL of the SharePoint site containing the folder to be deleted.
  • selOAuthProvider - The Select OAuth provider property specifies the OAuth provider that FlowWright should use when connecting to SharePoint.
  • destinationFilePath – The Path to delete folder in your SharePoint site property specifies the path of the folder that should be deleted.
  • Store Result in Variable/Global – The Store result in Variable/Global property specifies where the result of the folder-deletion operation should be stored.
 

 

Returns

  • True – The True return path represents a successful result from the step.
  • False – The False return path represents an unsuccessful result.
 

 

Usage:

The Delete Folder step is typically used when a workflow needs to remove a SharePoint folder as part of an automated document-management or cleanup process.

The folder path can be supplied as a workflow value, allowing the target folder to be determined dynamically based on information available to the process.

The result can be stored in a Variable or Global variable for use by subsequent workflow activities.

Typical uses include:

  • Cleaning up temporary folders.
  • Removing obsolete folders.
  • Deleting folders after a workflow completes.
  • Removing folders created for canceled processes.
  • Cleaning up archived workflow content.
  • Maintaining an automated SharePoint folder structure.
  • Removing folders as part of document-retention workflows.

Because the operation deletes a folder, the workflow should identify the target path carefully before executing the step.

 

Typical Workflow Suggestions:

Temporary Folder Cleanup

Create temporary folders during processing and remove them when the workflow finishes.

Example:

Create Folder → Process Documents → Delete Folder → Complete

This pattern is useful when a workflow needs temporary SharePoint storage during execution.

 

Canceled Process Cleanup

Remove folders associated with a canceled process.

Example:

Process Cancelled → Delete Folder → Record Cleanup Result

The folder path can indicate where the canceled process was created.

 

Project Cleanup

Use the step to remove a project-specific folder when project processing is complete.

Example:

Complete Project → Archive Required Documents → Delete Folder → Complete

 

Case Cleanup

Remove temporary case folders after case processing is complete.

Example:

Close Case → Archive Documents → Delete Folder → Complete

 

Document Retention

Use the step as part of an automated repository-maintenance process.

Example:

Identify Obsolete Content → Delete Folder → Record Result

The XML supports the folder path as a configurable string property, allowing workflows to identify the target dynamically.

 

Workflow Instance Cleanup

Use a workflow-specific folder for temporary output and remove it when processing is complete.

Example:

Start Process → Create Folder → Generate Files → Process Files → Delete Folder

 

SharePoint Repository Maintenance

Use Delete Folder as part of an automated SharePoint maintenance workflow.

Example:

Identify Folder → Validate Cleanup → Delete Folder → Log Result

 

Cleanup After Document Migration

Remove an old folder after its contents have been migrated, where appropriate.

Example:

Migrate Documents → Validate Migration → Delete Folder → Complete

The workflow should perform any required validation before the deletion step.

 

Failure Handling

Use the False return path to handle an unsuccessful deletion.

Example:

Delete Folder → True → Complete

↳ False → Log Failure / Notify Administrator

The step explicitly provides True and False return values.

 

Example:

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

  • Create a new definition called “spDeleteFolderDef” and open the definition in designer mode. 
  • Drag a “spDeleteFolder” step to the canvas.
  • Connect the dots between the “Start” and “spDeleteFolder” 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, additional values are available for configuration.
  • Define a variable or a global variable to store the result after execution.
  • Click the "spDeleteFolder" step to configure its "Required" properties. Provide a name for the step. Select the SharePoint provider from the dropdown list. Enter the SharePoint site's folder path to delete. Specify a variable or global to store the result. Click the Save button. Note: Click the "AI Predict" button for the Copilot to add new process steps that match your process description. 

 

  • The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. This is achieved by configuring 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. Click the process step to view its properties. The step should delete the folder from the SharePoint site. 

 

Tips:

  • Verify that BaseURL identifies the intended SharePoint site.
  • Select the appropriate configured OAuth provider.
  • Ensure that the OAuth provider has the necessary access to the target SharePoint location.
  • Verify the folder path carefully before executing the step.
  • Use workflow Variables when the folder path needs to be determined dynamically.
  • Confirm that the target folder is the intended one before deleting.
  • Use meaningful and consistent folder-naming conventions so cleanup workflows can reliably identify folders.
  • Store the operation result in a Variable or Global variable when subsequent workflow logic needs access to it.
  • Test the workflow against representative SharePoint folders before deploying it to production.
  • Test both the True and False paths.
  • Consider adding explicit logging or notification to the False path.
  • Use the deletion step only after any required documents have been archived, migrated, or otherwise processed.
  • Be especially careful when constructing the folder path dynamically; an incorrect path could target an unintended location.
  • Avoid hard-coding environment-specific SharePoint URLs when deploying the workflow across environments.
  • Verify SharePoint permissions before troubleshooting a failed deletion operation.
  • Consider placing validation or confirmation logic before a destructive folder operation.

 

Notes:

The Delete Folder step is defined in the SharePoint category with the internal name spdeletefolder, label Delete a folder from SharePoint site, and display name Delete Folder.

The step is implemented by FlowWright.Workflow.SpDeleteFolder in FlowWright.Workflow.dll and is a Process step with 2 incoming connections and 2 outgoing connections.

The XML defines four configurable properties, all of which are marked as required.

The BaseURL, destinationFilePath, and resultJson properties use the standard string data type, implemented by FlowWright.DataTypes.ClsTextBox

The Select OAuth provider property uses the SelOAuthProvider data type, implemented by FlowWright.DataTypes.SelOAuthProvider

The step provides two predefined return values: False and True.

 

Definition Sample:

You may download the sample definition(s) from the link provided and import them into your FlowWright Process Definition.

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

  • SharePoint Base URL
  • OAuth provider
  • Folder destination path
  • Result Variable/Global mapping
  • Environment-specific SharePoint settings
  • Downstream True and False workflow paths

Because this is a deletion operation, carefully verify the destination path before executing the imported definition.

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

Click here to download the sample file.