GithubHelp home page GithubHelp logo

englerdominik / oracle-apex-office-365-integration Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 31 KB

Integration of Oracle APEX and Office 365

microsoft-azure microsoft-graph office365 oracle-database oracle-apex postman api

oracle-apex-office-365-integration's Introduction

Integration of Oracle APEX and Office 365

The package contains the functions and procedures needed to load messages from Microsoft Outlook into the Oracle APEX application using Microsoft Graph. First of all, it is necessary to register the application on Azure in order to receive the corresponding codes that will later be used in the package (https://azure.microsoft.com/en-us). After we get the application (client) ID, directory (tenant) ID and client secret value, we are ready for further steps. About Microsoft Graph: "Microsoft Graph is the gateway to data and intelligence in Microsoft 365. It provides a unified programmability model that you can use to access the tremendous amount of data in Microsoft 365, Windows 10, and Enterprise Mobility + Security. Use the wealth of data in Microsoft Graph to build apps for organizations and consumers that interact with millions of users."

General about the package

The package consists of eight functions and two procedures that are explained in detail. First of all, the idea was for the client to enter data in the application such as, for example, the mail from which the messages will be read, then everything necessary to send the request: client id, tenant id, client secret value, wallet password and wallet path. All necessary values are stored in a table and called using functions to be used in procedures that send a request using apex_web_service.make_rest_request. After we retrieve the authentication token using the get_token function, we pass it to the get_messages procedure whose output parameter is in the form of a clob. We put the clob we got into the "temporary" table. The data in the table is in JSON format that needs to be parsed into another table, in this case the first table containing only JSON is called x_tmp, while the table into which we have to parse JSON is called mail_messages. The procedure that parses the JSON format and inserts it into the mail_messages table is called json_insert.

Testing with POSTMAN

After we have received all the necessary parameters for making the call (client id, tenant id and secret value), before we start working on the procedures and functions, it would be good to try to get the results in the form of JSON format in POSTMAN. It's an free API platform for developers to design, build, test and iterate their APIs. After you download it to your computer and log in, you can try fetching an authentication token and fetching a message from an email in JSON format in it, you will have only two methods. The method for retrieving the authentication token will be POST, while the method for retrieving messages will be GET. Likewise, it is necessary to set all the parameters that I will explain in further steps.

Retrieving authentication token:

  1. HTTP request method: POST
  2. URL: https://login.microsoftonline.com/{your_tenant_id}/oauth2/v2.0/token
  3. Headers: KEY: 'Content-Type' VALUE: 'application/x-www-form-urlencoded'
  4. Body: KEY: 'grant_type', 'client_id', client_secret', 'scope' VALUE: 'client_credentials', 'your_client_id', 'your_client_secret', 'https://graph.microsoft.com/.default'
  5. Press SEND

As a result, you should get token_type: Bearer and under access_token you should get a code that we will use later in retrieving messages. The next tab that we will add in POSTMAN will be for retrieving messages from Microsoft Outlook, steps on how to send a request:

  1. HTTP request method: GET
  2. URL: https://graph.microsoft.com/v1.0/users/{your_mail}/mailFolders/Inbox/messages?$select=id,receivedDateTime,hasAttachments,subject,bodyPreview,sender,from,importance ( The $select parameter determines which message data we will see in the query result, we can add parameters under the params menu, example: KEY - $select VALUE - id,receivedDateTime,hasAttachments,subject,bodyPreview,sender,from,importance)
  3. Under the authorization menu, our authorization type is Bearer token, and under the value we put the token we received
  4. Under the headers menu, we must add the following parameters: KEY - Content-Type VALUE - application/json KEY - Prefer VALUE - outlook.body-content-type=text, KEY - Authorization VALUE - Bearer your_token
  5. Press SEND

As a result, we received messages in JSON format. It is desirable to understand the way the request is sent in POSTMAN because we configure apex_web_service.make_rest_request in a similar way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.