Delete File Or Folder
Prerequisite Permissions: For Delete File or Folder on OneDrive following Microsoft Graph permissions are required.
| Permission type | Permission (from least to most privileged) |
|---|---|
| Delegated (work or school account) | Files.ReadWrite, Files.ReadWrite.All |
| Delegated (personal Microsoft account) | Files.ReadWrite, Files.ReadWrite.All |
Description
This step deletes a file or folder from OneDrive. You provide the path of the item to remove. Use this step in workflows that clean up processed files, remove temporary content, or automate housekeeping tasks on your OneDrive storage.
Note: Support is provided for the Personal Drive, however, the displayed error message is not correct.
Reference: https://docs.microsoft.com/en-us/graph/api/driveitem-delete?view=graph-rest-1.0&tabs=http
Configurations
| No. | Field Name | Description |
|---|---|---|
| Configuration: | ||
| 1 | Step Name | Name of the step. This name has to be unique in a single workflow. |
| Connection: | ||
| 2 | Client ID | Select the client ID for which you want to copy a file or folder. Note: This field is mandatory for personal accounts. |
| 3 | Checkbox: Accept value as variable/static | Leave checkbox unchecked to accept Refresh Token value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for Refresh Token field to appear as Text box. |
| 4 | Refresh Token | Specify the Refresh Token provided by authorization grant flow. The data type is String. This field is mandatory. |
| 5 | Button: Test Connection | Verifies whether the connection is established or not. |
| Input Tab | ||
| Input Fields: | ||
| 1 | File or Folder ID/ Path | Provide OneDrive file/folder ID or path to delete file or folder The field data type is String. This is mandatory. To delete a folder in root specify - Documents/ Else to delete a file/folder in any other path - Get OneDrive Path/ID as described in sections – • You can use the ‘Upload File’ step to get Folder/File ID as an output of step execution. e.g. If OneDrive path == https://organization-my.sharepoint.com/personal/xyz/Documents/demofolder/File.xlsx Then provide, • Documents/demofolder/File.xlsx • demofolder/File.xlsx |