如何使用 Microsoft graph API 删除部分上传到 Onedrive 的文件

How to remove partially uploaded file to Onedrive using Microsoft graph API

由于某些互联网问题,使用 Microsoft graph API 将文件部分上传到 Onedrive。现在上传的文件不完整并且有一些临时扩展名。文件大小超过10MB,上传才几MB

请求如下所示:

POST /drive/root:/{item-path}:/createUploadSession

我的问题是如何使用图 API 删除此类文件。

如果一段时间后未能完全上传,是否有任何方法可以提供此类信息以及删除此类文件的请求。

是的。您可以将 DELETE 发送到上传会话 URL。

来自documentation

To cancel an upload session send a DELETE request to the upload URL. This cleans up the temporary file holding the data previously uploaded. This should be used in scenarios where the upload is aborted, for example, if the user cancels the transfer.

Temporary files and their accompanying upload session are automatically cleaned up after the expirationDateTime has passed. Temporary files may not be deleted immediately after the expiration time has elapsed.