The Graph one is currently a Delegate level permission only, the Exchange one can also be granted at the application level. You need to use client credential flow, so you need to use Office 365 Exchange online IMAP.AccessAsApp.
More details can be found at this link:
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.