Delete a file
You can delete existing files in OneDrive from a solution in the . This can be used to remove incorrect files or files that are no longer required. First, you must return the files available in OneDrive, for example, in a list, select the file to be deleted by configuring a button or swipeable element, then use the OneDrive Data Provider, its delete method, and required properties.
The following properties are required in the YAML:
- entity- file path in OneDrive
- id - reference the physical file by its id
- tokenType - OAuth token credentials name
- method: delete
- The path entity is not used in the deletion process
- Files are deleted in all folders as expected, even when the incorrect folder is specified as the delete method uses id
- A delay or time lag of several minutes could be experienced when files are syncing between the device and OneDrive
The code example below provides an example of a list of invoices in the myfiles directory of OneDrive. When swiping left and pressing the Delete button deletes the file on OneDrive.