Deleting older emails in outlook.com in web app has its limitations. You can only delete upto 1025 emails in one go but I had like more than 450k emails in my inbox. And my storage was also running out.
So I was looking for a easy and effective way to cleanup my inbox.
I can't go through each and every email and I was also not sure which emails I have received are also important.
So I thought of writing a small script that deletes the old emails in the given time frame with some additional options.
- Outook Access token
- Node
- NPM
- Clone
- npm i
- Paste the token in index.js file
- Review or change the email date range you need to delete
- Run index.js file
- Visit https://developer.microsoft.com/en-us/graph/graph-explorer
- Sign in to Graph explorer
- Click on 'my mail' under 'Getting started' tab
- Now Click on Modify Permissions(Preview) tab in the editor
- You need to give access to 'Mail.read' and 'Mail.ReadWrite'
- Once you give the consent for both the permissions, go to Access token tab in the editor and copy the access token
https://docs.microsoft.com/en-us/graph/overview?view=graph-rest-1.0
https://developer.microsoft.com/en-us/graph/graph-explorer
https://docs.microsoft.com/en-us/graph/search-concept-overview
https://docs.microsoft.com/en-us/graph/api/resources/mail-api-overview?view=graph-rest-1.0
https://docs.microsoft.com/en-us/graph/query-parameters#select-parameter
https://docs.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0