8/22/2023
PowerShell function using EWS (OAuth2) to perform these operations against Exchange Online Mailboxes.
So far there are two functions included in this module.
Get-EwsFolderInbox, Drafts)AQMkADRmZTI3MW..)Move-EwsItemNote: These functions use OAuth token to authenticate with Exchange Online. Basic authentication using username and password is not supported
A registered Azure AD app
API Name: Exchange
API Permission Type: Application
API Permission Name: full_access_as_app

A registered Azure AD App with full_access_as_app API permisson
Windows PowerShell 5.1
For getting access tokens, you can have either MSAL.PS or ADAL.PS
Download the module and extract the ZIP file on your computer.

Extract the module files on your computer
Open PowerShell as Administrator, change the working directory to the location of the module.
Run the script .\install.ps1 -ModulePath 'C:\Program Files\WindowsPowerShell\Modules' -Verbose

Install the module
.\uninstall.ps1 -Verbose. 
Make sure to acquire an access token first. Use the Get-MsalToken cmdlet or Get-AdalToken.
# Get MSAL Token using CLIENT ID, CLIENT SECRET, and TENANT ID
$msalParams = @{
ClientId = 'CLIENT ID'
ClientSecret = (ConvertTo-SecureString 'CLIENT SECRET' -AsPlainText -Force)
TenantId = 'TENANT ID'
Scopes = "https://outlook.office.com/.default"
}
$token = Get-MsalToken @msalParams
# Get MSAL Token using CLIENT ID, CLIENT SECRET, and TENANT ID
$msalParams = @{
ClientId = 'CLIENT ID'
ClientSecret = (ConvertTo-SecureString 'CLIENT SECRET' -AsPlainText -Force)
TenantId = 'TENANT ID'
Resource = "https://outlook.office.com/"
}
$token = Get-MsalToken @msalParams
Visit the MSAL.PS GitHub page to learn more about using MSAL.PS module to acquire OAuth access tokens.