Created
August 13, 2019 13:46
-
-
Save justinyoo/b0865f6d2b7c42645e2e8a2058a0de1f to your computer and use it in GitHub Desktop.
Enriching Mail Filtering Rules by Azure Logic Apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Filter_Recipients": { | |
"type": "Query", | |
"runAfter": { | |
"Get_All_Recipients": [ | |
"Succeeded" | |
] | |
}, | |
"inputs": { | |
"from": "@variables('FolderLookupReferences')", | |
"where": "@contains(outputs('Get_All_Recipients'), item()?.email)" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Get_All_Recipients": { | |
"type": "Compose", | |
"runAfter": { | |
"Initialise_Folder_Lookup_References": [ | |
"Succeeded" | |
] | |
}, | |
"inputs": "@union(coalesce(split(triggerBody()?['Cc'], json('[]')), ';'), split(coalesce(triggerBody()?['To'], json('[]')), ';'))" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"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" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"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" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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']}" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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" | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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