spDeleteDocument Step
Description:
The Delete Folder Document workflow step deletes a specified document from a SharePoint site.
The step uses the configured SharePoint site Base URL and OAuth provider to access SharePoint, identifies the document using its path, and stores the operation result in a FlowWright Variable or Global variable.
The step supports:
- Deleting a document from a SharePoint site.
- Configuring the SharePoint site Base URL.
- Selecting an OAuth provider.
- Specifying the path of the document 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 documents.
- Cleaning up documents created during workflow execution.
- Deleting obsolete documents.
- Removing documents associated with canceled processes.
- Automating SharePoint document-retention or cleanup processes.
- Maintaining SharePoint document repositories.
- Integrating document deletion into FlowWright workflows.
Inputs
- BaseURL – The BaseURL for your SharePoint site property specifies the Base URL of the SharePoint site containing the document 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 file in your SharePoint site property specifies the path of the document that should be deleted.
- Store Result in Variable/Global – The Store result in Variable/Global property specifies where the result of the document-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 Document step is typically used when a workflow needs to remove a document from SharePoint as part of an automated document-management or cleanup process.
The document path can be supplied as a workflow value, allowing the target document 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 documents.
- Removing obsolete documents.
- Deleting documents after workflow completion.
- Removing documents associated with canceled processes.
- Maintaining SharePoint document repositories.
- Implementing automated document-retention processes.
- Cleaning up intermediate workflow output.
Because the operation deletes a document, the workflow should identify and validate the target path carefully before executing the step.

Typical Workflow Suggestions:
Temporary Document Cleanup
Create temporary documents during workflow execution and remove them when they are no longer required.
Example:
Generate Temporary Document → Process Document → Delete Folder Document → Complete
This pattern is useful when a workflow creates intermediate SharePoint files.
Canceled Process Cleanup
Remove documents associated with a canceled process.
Example:
Process Cancelled → Delete Folder Document → Record Cleanup Result
The document path can identify the file created for the canceled process.
Obsolete Document Removal
Use the step as part of an automated document-maintenance workflow.
Example:
Identify Obsolete Document → Validate → Delete Folder Document → Record Result
Workflow Output Cleanup
Remove intermediate output after the workflow has completed the required processing.
Example:
Create Document → Process Document → Store Final Result → Delete Folder Document
Document Migration Cleanup
Delete an old document after its replacement has been created or migrated.
Example:
Create Replacement → Validate → Delete Folder Document → Complete
The workflow should perform any required validation before the deletion operation.
Temporary Processing Files
Use the step to clean up files created for intermediate processing.
Example:
Create Temporary File → Process → Store Result → Delete Folder Document
SharePoint Repository Maintenance
Use Delete Folder Document as part of an automated SharePoint maintenance workflow.
Example:
Identify Documents → Validate Cleanup → Delete Folder Document → Log Result
Retention Processing
Use the step to remove documents that have reached the appropriate point in a document-retention process.
Example:
Identify Retention Candidates → Validate → Delete Folder Document → Record Result
The XML supports the document path as a configurable string property, allowing workflows to identify the target dynamically.
Failure Handling
Use the False return path to handle an unsuccessful deletion.
Example:
Delete Folder Document → True → Complete
↳ False → Log Failure / Notify Administrator
The step explicitly provides True and False return values.
Example:
Let’s build and execute the “spDeleteDocumentDef” example.
- Create a new definition called “spDeleteDocumentDef” and open the definition in designer mode.
- Drag a “spDeleteDocument” step to the canvas.
- Connect the dots between the “Start” and “spDeleteDocument” 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.
- Click the "spDeleteDocument" step to configure its "Required" properties. Provide a name for the step. Enter the base URL for the SharePoint site. Select the SharePoint provider from the dropdown list. Enter the path to the file you want to delete. Specify a variable or a 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. When the workflow reaches the Delete Folder Document step, FlowWright uses the configured SharePoint site, OAuth provider, and document path to perform the deletion operation. The result is stored in the configured Variable or Global variable.
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 document.
- Verify the document path carefully before executing the step.
- Use workflow Variables when the document path needs to be determined dynamically.
- Confirm that the target document is the intended document before performing the deletion.
- Use meaningful and consistent document-naming conventions so cleanup workflows can reliably identify files.
- Store the operation result in a Variable or Global variable when subsequent workflow logic needs access to it.
- Test the configured SharePoint connection before deploying the workflow.
- 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 document has been archived, migrated, or otherwise processed.
- Be especially careful when constructing the document path dynamically; an incorrect path could target an unintended document.
- Avoid hard-coding environment-specific SharePoint URLs when deploying the workflow across environments.
- Verify SharePoint permissions when troubleshooting a failed deletion.
- Consider placing validation or confirmation logic before a destructive document operation.
Notes:
The Delete Folder Document step is defined in the SharePoint category with the internal name spdeletedocument, label Delete a document on the SharePoint site, and display name Delete Folder Document.
The step is implemented by FlowWright.Workflow.SpDeleteDocument 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
- Document 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 document path before executing the imported definition.
After verifying the configuration, save the Process Definition before execution.
Click here to download the sample file.