Delete a file or folder with Graph API
Ever needed to programmatically delete files or folders from SharePoint? Whether you’re enforcing data retention policies, cleaning up processed files, or simply keeping your document libraries tidy, the Microsoft Graph API combined with Power Automate makes it straightforward. In this post, I’ll walk you through every step — from obtaining the right IDs to making the DELETE call. Why Automate File Deletion? There are several reasons why one might want to delete a SharePoint file or folder via the Graph API using Power Automate. Firstly, automating deletion can help maintain the organization and cleanliness of a SharePoint site, especially when dealing with temporary or obsolete files. Secondly, it allows for the enforcement of data retention policies by programmatically removing files that are past their retention period. Thirdly, it can be used to streamline workflows by deleting files that have been processed, reducing clutter and potential confusion. ...