OneDrive - Permanently Delete A File

Gil Shallem 5 Reputation points
2024-01-18T12:50:55.17+00:00

I am trying to permanently delete a file from drive using Microsoft Graph API

I managed to delete the file using this endpoint: DELETE /me/drive/items/{item-id}

but it just sends it to the deleted items folder. I need to permanently delete the item

I tried: POST /drives/{drive-id}/items/{item-id}/permanentDelete

*I changed drive-id, and item-id to the right values!

I am receiving the following response

{     
	"error": {         
				"code": "invalidRequest",         
				"innerError": {             
					"client-request-id": "92c1fbad-0857-4bb0-a13b-21300b2c9f6a",  
				    "date": "2024-01-18T12:30:31",             
					"request-id": "92c1fbad-0857-4bb0-a13b-21300b2c9f6a"         
				},         
				"message": "API not found"  
			}  
} 

Please help

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,992 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,299 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 45,101 Reputation points
    2024-01-19T03:09:39.7+00:00

    Hi @Gil Shallem

    This is a doc bug. In fact, OneDrive personal accounts do not support the permanentDelete API, it only applies to OneDrive for Business and SharePoint document libraries.

    Please submit a user voice for this or open a support ticket.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.