OneDrive Permanently Delete Item

Joseph Murphy 30 Reputation points
2023-08-23T22:50:51.3566667+00:00

Hello,

Looking at the docs for the Graph API, I noticed there is a new method for permanently deleting a file, bypassing the recycle bin, permanentDelete. However, when I tried to run this method, it did not work, giving me a 400 error with "API Not Found". Am I doing something wrong? This is the URL I used:

https://graph.microsoft.com/v1.0/drives/[driveId]/items/[itemId]/permanentDelete
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,987 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,748 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 38,436 Reputation points
    2023-08-24T02:20:34.13+00:00

    Hi @Joseph Murphy

    Your request URL is missing the drive ID, try calling the following API endpoint:

    POST /drives/{drive-id}/items/{item-id}/permanentDelete
    

    User's image

    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.


1 additional answer

Sort by: Most helpful
  1. msft-gu 1,350 Reputation points
    2023-08-24T00:27:07.84+00:00

    Hello Joseph Murphy,

    Good day and thank you for your question. I tested https://learn.microsoft.com/en-us/graph/api/driveitem-permanentdelete?view=graph-rest-1.0 using Graph Explorer and I did not encounter any issues. I received a response 204 No Content.

    Can I please know where are you receiving 400 error?

    400 Bad Request Cannot process the request because it is malformed or incorrect.

    Reference: https://learn.microsoft.com/en-us/graph/errors