Whatever message this page gives is out now! Go check it out!
<cfoauth
clientid = "client-id"
secretkey = "secret-key"
scope="https://outlook.office.com/SMTP.Send"
authendpoint="auth-end-point"
accesstokenendpoint = "access-token-endpoint"
result = "res"
redirecturi = "http://localhost:8500/oauth/response.cfm"><cfhttp result="res" url="https://login.microsoftonline.com/<auth-code>/oauth2/v2.0/token" method="post">
<cfhttpparam name="grant_type" type="formfield" value="authorization_code">
<cfhttpparam name="code" type="formfield" value="#code#">
<cfhttpparam name="client_id" type="formfield" value="client-id">
<cfhttpparam name="scope" type="formfield" value="https://outlook.office.com/SMTP.Send">
<cfhttpparam name="client_secret" type="formfield" value="secret-key">
<cfhttpparam name="redirect_uri" type="formfield" value="http://localhost:8500/oauth/response.cfm">
</cfhttp>
<cfset record=deserializeJSON(res.Filecontent)/>
<cfset token=#record.access_token#/><cfmail server="smtp.office365.com" to="username@example.com" from="username@example.com" subject="#emailid#" port="587" username="#username#"
password="#token#" spoolenable=false useTLS=true timeout=120>
Hello, World!
</cfmail><cfoauth
clientid = "client-id"
secretkey = "secret-key"
scope="https://outlook.office.com/POP.AccessAsUser.All"
authendpoint="auth-end-point"
accesstokenendpoint = "access-token-endpoint"
result = "res"
redirecturi = http://localhost:8500/oauth/response.cfm><cfhttp result="res" url="https://login.microsoftonline.com/<auth-code>/oauth2/v2.0/token" method="post">
<cfhttpparam name="grant_type" type="formfield" value="authorization_code">
<cfhttpparam name="code" type="formfield" value="#code#">
<cfhttpparam name="client_id" type="formfield" value="client-id">
<cfhttpparam name="scope" type="formfield" value="https://outlook.office.com/POP.Send">
<cfhttpparam name="client_secret" type="formfield" value="secret-key">
<cfhttpparam name="redirect_uri" type="formfield" value="http://localhost:8500/oauth/response.cfm">
</cfhttp>
<cfset record=deserializeJSON(res.Filecontent)/>
<cfset token=#record.access_token#/><cfpop server = "outlook.office365.com" username = "#username#" password="#token#" port="995" action="GETALL" name="msg" secure="true"><cfoauth
clientid = "client-id"
secretkey = "secret-key"
scope="https://outlook.office.com/IMAP.AccessAsUser.All"
authendpoint="auth-end-point"
accesstokenendpoint = "access-token-endpoint"
result = "res"
redirecturi = http://localhost:8500/oauth/response.cfm><cfhttp result="res" url="https://login.microsoftonline.com/<auth-code>/oauth2/v2.0/token" method="post">
<cfhttpparam name="grant_type" type="formfield" value="authorization_code">
<cfhttpparam name="code" type="formfield" value="#code#">
<cfhttpparam name="client_id" type="formfield" value="client-id">
<cfhttpparam name="scope" type="formfield" value="https://outlook.office.com/IMAP.Send">
<cfhttpparam name="client_secret" type="formfield" value="secret-key">
<cfhttpparam name="redirect_uri" type="formfield" value="http://localhost:8500/oauth/response.cfm">
</cfhttp>
<cfset record=deserializeJSON(res.Filecontent)/>
<cfset token=#record.access_token#/><cfimap action="OPEN" connection="IMAPCONNECTION" server="outlook.office365.com"
username="#username#" password="#token#" secure="true" stoponerror="false"/>
<cfimap action="LISTALLFOLDERS" connection="IMAPCONNECTION" name="queryname" recurse=true stoponerror="false"/><cfoauth
clientid = "your clientid"
secretkey = "secret created in Azure portal when registering the application"
scope = "https://outlook.office365.com/EWS.AccessAsUser.All"
authendpoint = "https://login.microsoftonline.com/<tenant-ID>/oauth2/v2.0/authorize"
accesstokenendpoint = "https://login.microsoftonline.com/<tenant-ID>/v2.0/token"
result = "oresult"
redirecturi = "http://localhost:8500/oauth/response.cfm"><cfhttp result="httpresult" url="https://login.microsoftonline.com/<tenant-ID>/oauth2/v2.0/token" method="post">
<cfhttpparam name="grant_type" type="formfield" value="authorization_code">
<cfhttpparam name="scope" type="formfield" value="https://outlook.office365.com/EWS.AccessAsUser.All">
<cfhttpparam name="code" type="formfield" value="#url.code#">
<cfhttpparam name="client_id" type="formfield" value="your clientid">
<cfhttpparam name="redirect_uri" type="formfield" value="http://localhost:8500/oauth/response.cfm">
</cfhttp>
<cfdump var=#res.Filecontent#> // the access_token in the response here contains the access_token passed in the cfexchange tag
<cfexchangeconnection action="open"
username="username@domain.com"
password="#auth-token#"
server="outlook.office365.com"
protocol="https"
serverversion="2010_SP2"
connection="exchangeconn">