Hi @Anirban Das
Make sure that you are granting the Mail.ReadWrite
application permission and not the delegated permission. After granting permissions, you need to acquire a token using the daemon-based client credentials flow.
Call the graph API endpoint:
Also, make sure that the application permissions are not restricted by the administrator to only specific Exchange Online mailboxes, or you will still receive this error.
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.