Forum Discussion
GarbledSpaceman
Oct 18, 2021Copper Contributor
What OAuth permissions needed for exchangelib?
My end goal is to have a script that moves a single users mail around (archiving stuff etc.). Right now I'm just trying to be able to look at the mail. I'm using a python library called https://githu...
cosmin-robocorp
Jul 06, 2022Copper Contributor
Maybe you're missing the `full_access_as_app` Office 365 Application permission. Here are some full instructions on how I managed to do the auth and send an e-mail to myself into an Exchange Online sandbox tenant: https://github.com/robocorp/example-oauth-email#microsoft-exchange-outlook
Main takeaways:
- Created Web App and authorized with the Authorization Code flow (with OAuth2 enabled in the tenant)
- Ensured enough permissions (Delegated / Application) for the app (even accepted them all in advance as the Principal user)
- Enabled Impersonation as well through PowerShell (so the app can send mails on user's behalf)
Main takeaways:
- Created Web App and authorized with the Authorization Code flow (with OAuth2 enabled in the tenant)
- Ensured enough permissions (Delegated / Application) for the app (even accepted them all in advance as the Principal user)
- Enabled Impersonation as well through PowerShell (so the app can send mails on user's behalf)