Office 365 and EWS with OAuth 2.0 authentication in unattended (app-only) mode: How to make it work
App-only authentication is used for services/daemons with no singed-in user present. This step-by-step guide shows how to make it work with Rebex EWS library.