Model Context Protocol (MCP) finally gives AI models a way to access the business data needed to make them really useful at work. CData MCP Servers have the depth and performance to make sure AI has access to all of the answers.
Try them now for free →Trigger Microsoft Exchange IFTTT Flows in Azure App Service
This article shows how to automate IFTTT (if-this-then-that) workflows with standard wizards in Logic Apps.
Through standards-based interfaces like OData and Swagger, the CData API Server provides a native experience in Logic Apps and Power Automate with Microsoft Exchange. OData enables real-time connectivity to data; Swagger enables scaffolding, or code generation, of wizards in Logic Apps and Power Automate, as well as scaffolding Power Apps. This article shows how to add Microsoft Exchange to an IFTTT (if-this-then-that) workflow in a Logic App.
Set Up the API Server
If you have not already done so, download the CData API Server. Once you have installed the API Server, follow the steps below to begin producing secure Microsoft Exchange OData services:
Connect to Microsoft Exchange
To work with Microsoft Exchange data in a Logic App, we start by creating and configuring a Microsoft Exchange connection. Follow the steps below to configure the API Server to connect to Microsoft Exchange data:
- First, navigate to the Connections page.
-
Click Add Connection and then search for and select the Microsoft Exchange connection.
-
Enter the necessary authentication properties to connect to Microsoft Exchange.
Specify the User and Password to connect to Exchange. Additionally, specify the address of the Exchange server you are connecting to and the Platform associated with the server.
- After configuring the connection, click Save & Test to confirm a successful connection.
Configure API Server Users
Next, create a user to access your Microsoft Exchange data through the API Server. You can add and configure users on the Users page. Follow the steps below to configure and create a user:
- On the Users page, click Add User to open the Add User dialog.
-
Next, set the Role, Username, and Privileges properties and then click Add User.
-
An Authtoken is then generated for the user. You can find the Authtoken and other information for each user on the Users page:
Creating API Endpoints for Microsoft Exchange
Having created a user, you are ready to create API endpoints for the Microsoft Exchange tables:
-
First, navigate to the API page and then click
Add Table
.
-
Select the connection you wish to access and click Next.
-
With the connection selected, create endpoints by selecting each table and then clicking Confirm.
Gather the OData Url
Having configured a connection to Microsoft Exchange data, created a user, and added resources to the API Server, you now have an easily accessible REST API based on the OData protocol for those resources. From the API page in API Server, you can view and copy the API Endpoints for the API:
Access Microsoft Exchange in a Logic App
You can use the API Server in a Logic App to create process flows around Microsoft Exchange data. The HTTP + Swagger action provides a wizard to define the operations you want to execute to Microsoft Exchange. The following steps below show how to retrieve Microsoft Exchange data in a Logic App.
If your table has a column containing the creation date of a record, you can follow the steps below to write a function to check the column values for any new records. Otherwise, skip to the Create a Logic App section to send out emails to entities that match a filter.
Check for New Microsoft Exchange Entities
To find new Microsoft Exchange entities since a certain time, you can write a function that retrieves a datetime value for the start of the interval:
- In the Azure Portal, click New -> Function App -> Create.
- Enter a name and select the subscription, resource group, App Service plan, and storage account.
- Select your Function App and select the Webhook + API scenario.
- Select the language. This article uses JavaScript.
- Add the following code to return the previous hour in a JSON object:
module.exports = function (context, data) { var d = new Date(); d.setHours(d.getHours()-1); // Response of the function to be used later. context.res = { body: { start: d } }; context.done(); };
Add Microsoft Exchange to a Trigger
Follow the steps below to create a trigger that searches Microsoft Exchange for results that match a filter. If you created the function above, you can search for objects that were created after the start of the interval returned.
- In the Azure Portal, click New and in the Web + Mobile section select Logic App and select a resource group and App Service plan.
- You can then use the wizards available in the Logic App Designer, which can be accessed from the settings blade for the Logic App. Select the Blank Logic App template.
- Add a Recurrence action that will poll for the Microsoft Exchange objects. This article polls every hour. Select the timezone -- the default is UTC.
- Add a function action: Expand the menu in the Add Action dialog and select the option to show Azure functions in the same region. Select the Function App you created earlier and select the function that returns the interval start.
- Enter an empty pair of curly brackets, "{}", to pass an empty payload object to the function.
- Add the HTTP + Swagger action and enter the swagger URL of the API Server:
http://MySite:MyPort/api.rsc/@MyAuthtoken/$oas
- Select the "Return Contacts" operation.
Use the descriptions for each property to specify additional parameters such as the columns to retrieve, filters, etc. Below is an example filter:
BusinnessAddress_City eq 'Raleigh'
The API Server returns the descriptions and other documentation in the swagger document. You can find more information on using the OData API and supported OData in the API Server help documentation.
To use the datetime value returned from the getInterval function, use the "ge" operator with a datetime column in the Contacts table and select the Body parameter in the dialog. Note that quotes must be used to surround the datetime value.
Switch to Code View and modify the $filter expression to extract the property containing the start of the interval. Use the syntax '@{body('MyFunc')['MyProp']'.
"getAllAccount": { "inputs": { "method": "get", "queries": { "$filter": "CreatedDate ge '@{body('getInterval')['start']}'" }, "uri": "https://MySite:MyPort/api.rsc/@MyAuthtoken/Contacts" }
You can now access Microsoft Exchange as data sources and destinations in your workflows.
Email New Records
Follow the steps below to email a report with any new Contacts entities.
- In the Logic Apps Designer, add an SMTP - Send Email action.
- Configure the necessary information for the SMTP server.
- Configure the From, To, Subject, and Body. You can add parameters from the Microsoft Exchange columns returned.
Click Save and then click Run to send email notifications on any Microsoft Exchange records created in the last hour.