Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enriching Mail Filtering Rules by Azure Logic Apps
"Filter_Recipients": {
"type": "Query",
"runAfter": {
"Get_All_Recipients": [
"Succeeded"
]
},
"inputs": {
"from": "@variables('FolderLookupReferences')",
"where": "@contains(outputs('Get_All_Recipients'), item()?.email)"
}
}
"Get_All_Recipients": {
"type": "Compose",
"runAfter": {
"Initialise_Folder_Lookup_References": [
"Succeeded"
]
},
"inputs": "@union(coalesce(split(triggerBody()?['Cc'], json('[]')), ';'), split(coalesce(triggerBody()?['To'], json('[]')), ';'))"
},
[
{
"email": "mvp-dotnet@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": ".NET"
},
{
"email": "mvp-asp.net@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "ASP.NET-IIS"
},
{
"email": "mvp-azure@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "Azure"
},
{
"email": "mvp-devops@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "DevOps"
},
{
"email": "mvp-integration@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "Integration"
},
{
"email": "mvp-office365@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "Office365"
},
{
"email": "mvp-windows@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "Windows"
},
{
"email": "mvp-xamarin@mailing-list.net",
"folderId": "AQMkADAwAT****************AAAA==",
"displayName": "Xamarin"
}
]
[
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": ".NET"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "ASP.NET-IIS"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "Azure"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "DevOps"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "Integration"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "Office365"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "Windows"
},
{
"id": "AQMkADAwAT****************AAAA==",
"displayName": "Xamarin"
}
]
"Move_Email_to_Designated_Folder": {
"type": "ApiConnection",
"runAfter": {
"Take_the_First_Recipient": [
"Succeeded"
]
},
"inputs": {
"method": "post",
"host": {
"connection": {
"name": "@parameters('$connections')['outlook']['connectionId']"
}
},
"path": "/Mail/Move/@{encodeURIComponent(triggerBody()?['Id'])}",
"queries": {
"folderPath": "Id::@{outputs('Take_the_First_Recipient')?['folderId']}"
}
}
}
"Stop_Processing_If_Filter_Returns_Empty": {
"type": "If",
"runAfter": {
"Filter_Recipients": [
"Succeeded"
]
},
"expression": {
"and": [
{
"equals": [
"@length(coalesce(body('Filter_Recipients'), json('[]')))",
0
]
}
]
},
"actions": {
"Cancel_Processing_Due_to_No_Recipient_Found": {
"type": "Terminate",
"runAfter": {},
"inputs": {
"runStatus": "Cancelled"
}
}
}
}
"Take_the_First_Recipient": {
"type": "Compose",
"runAfter": {
"Stop_Processing_If_Filter_Returns_Empty": [
"Succeeded"
]
},
"inputs": "@first(body('Filter_Recipients'))"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.