One of the cool features of coding in Visual Studio is the ability to mix and match between X++ projects and C# projects in one solution. A very useful example of this feature is authenticating an Office 365 username and password directly from Dynamics 365 for Operations. To achieve this, the Unirest API package must be obtained and installed from:

Then Office 365 authentication can be achieved in a simple manner:


And here is how to call the above code from X++: