diff --git a/samples/flow-excel-groupbyemail-notification-example/README.md b/samples/flow-excel-groupbyemail-notification-example/README.md new file mode 100644 index 00000000..057b336b --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/README.md @@ -0,0 +1,109 @@ +# Demonstration flow on how to process incoming excel email attachments, to group work items by EmailAddress for employees and email them their tasks + +## Summary + +This sample demonstrates how to receive an Excel File over email, download the file, save it to SharePoint, then process the file by grouping by value EmployeeEmail and then emailing each employee their work items in an HTML Table. +There are instructions and details in the assets folder, in a file called Excel GroupBy Example Phase I.docx + +![Flow overview part 1](./assets/Flow_Image_1.jpg "Flow overview part 1") +![Flow overview part 2](./assets/Flow_Image_2.jpg "Flow overview Part 2") +![Flow overview part 3](./assets/Flow_Image_3.jpg "Flow overview Part 3") +![SharePoint Folder Details](./assets/Flow_Image_3.jpg "SharePoint Folder Details") + + +## Applies to + +![Power Automate](https://img.shields.io/badge/Power%20Automate-Yes-green "Yes") + +## Compatibility + +![Premium License](https://img.shields.io/badge/Premium%20License-Not%20Required-green.svg "Does not use Premium license") +![On-Premises Connectors](https://img.shields.io/badge/On--Premises%20Connectors-No-green.svg "Does not use on-premise connectors") +![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-Not%20Required-green.svg "Does not use custom connectors") + +## Contributors + +* [Michael Gernaey](https://github.com/MichaelGernaey) + +## Version history + +Version|Date|Comments +-------|----|-------- +1.0|June 20, 2025|Initial release + +## Prerequisites + +### Instructions + +* Review the Excel GroupBy Example Phase 1.docx that covers the entire flow from a functional and technical perspective in the assest folder as your first step +* Please use the workitems.xlsx in the assets folder for your Attachment +* Please use the term workitems for your Emails Subject. This is the email that you will send yourself(or whatever emai you configure) to trigger your flow +* Change the Connections and Folder pointers in the Flow to point to your own SharePoint +* Note: Image Flow_Image_4.jpg shows the folder structure I am using, you can use whatever you like as long as you configure it in the flow that way +* Change the Outlook Trigger Details pointing to the correct folder and account +* Change the Outlook Send Email, Email Addresses in the Catch, Success and if no (false) condition/action areas to send to whomever you like. +* These are emails that are intended to tell operations the status of the flow as part of the "business requirements in the document" +* NOTE: the 10 minute delay is due to the Excel locking issue it will go from seconds to upwards of 10 minutes when used with SharePoint +* Please use the following environment variables. Please read about them more in the instructions in the asset folder +* Attachment_File_Creation_Folder : This is the path to the location where the attachment will be saved (Example: /ExcelExamples/GroupBy/WorkItems) +* Email_Subject_Filter_String : This is the email subject filter used to validate we want to process this email (Example: WorkItems) +* Email_Attachment_Name : The name of the attachment file (Example workitems.xlsx) +* Excel_File_Location_Uri_For_List_Rows : In the Excel List Rows, the Uri to where the new file to process is in SharePoint (Example: GroupBy/WorkItems/) +* Excel_Table_Name : The Excel Table Name (Example: WorkItems) +* Notification_Email_Address : The pretend operations email address (Example: myopts@mytestopts.com) +* SharePoint_Document_Library_Metadata_Id : This is the actual Meta-Data Id of the document library for the Excel List Rows. This requires more information and is detailed in the manual but you can get it like this: +-Get your full url to your site +-Append the following as such +https://mysharpeointhostname.sharepoint.com/sites/TGC/_api/v2.1/drives +-This will generate a JSON. You must look into the JSON and grab the document library Id, not the GUID, for the library you want to use. This is another learning exercise as well :-) +(Example: b!GIfmRAVVw0mcFoQzYGhW-r3_yytMP19AvCd-ZdKecbLx0LomIb1QQJRqbnEl1-ia), noting that this is NOT the GUID, its the ID. +* SharePoint_Processed_Folder_Target_Location : The sharepoint folder path to store successfully processed files (Example: /ExcelExamples/GroupBy/Processed) +* Source_SharePoint_Url : The Source SharePoint Url to store the files and process them in (Example https://mysharepoint.com/sites/TGC) +* Target_SharePoint_Url : The Target SharePoint Url to store the processed files (Example https://mytargetsharepoint.com/sites/TGC) +## Minimal Path to Awesome + +### Import Solution + +* [Download](./solution/flow-excel-groupbyemail-notification-example.zip) the `.zip` from the `solution` folder +* [Import](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/import-update-export-solutions) the `.zip` file using **Solutions** > **Import Solution**. + +### Using the source code + +You can also use the [Power Apps CLI](https://docs.microsoft.com/powerapps/developer/data-platform/powerapps-cli) to pack the source code by following these steps: + +* Clone the repository to a local drive +* Pack the source files back into a solution `.zip` file: + + ```bash + pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder --processCanvasApps + ``` + + Making sure to replace `pathtosourcefolder` to point to the path to this sample's `sourcecode` folder, and `pathtodestinationfile` to point to the path of this solution's `.zip` file (located under the `solution` folder) +* Within **Power Apps Studio**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed. + +## Features + +This sample illustrates the following concepts: + +* Reusablility +* Use of using Excel +* Use of using Outlook Triggers +* Email Attachment Processing +* Creating a Unique Email by Grouping Excel Rows by Value +* Terminating Flows to capture Success or Failure into the Flow Detail 28 day Run Logs + +## Help + +We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues. + +If you encounter any issues while using this sample, you can [create a new issue](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=utility-flow-for-aggregrate-operations-on-array&authors=@Solanki-Manish&title=utility-flow-for-aggregrate-operations-on-array). + +For questions regarding this sample, [create a new question](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=utility-flow-for-aggregrate-operations-on-array&authors=@Solanki-Manish&title=utility-flow-for-aggregrate-operations-on-array). + +Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=utility-flow-for-aggregrate-operations-on-array&authors=@Solanki-Manish&title=utility-flow-for-aggregrate-operations-on-array). + +## Disclaimer + +**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** + + diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/Excel GroupBy Example Phase I.docx b/samples/flow-excel-groupbyemail-notification-example/assets/Excel GroupBy Example Phase I.docx new file mode 100644 index 00000000..f18aaa26 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/Excel GroupBy Example Phase I.docx differ diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Full.jpg b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Full.jpg new file mode 100644 index 00000000..fb808a60 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Full.jpg differ diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_1.jpg b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_1.jpg new file mode 100644 index 00000000..ba9ac591 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_1.jpg differ diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_2.jpg b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_2.jpg new file mode 100644 index 00000000..d3a6b8c8 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_2.jpg differ diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_3.jpg b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_3.jpg new file mode 100644 index 00000000..9c9ea4bd Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_3.jpg differ diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_4.jpg b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_4.jpg new file mode 100644 index 00000000..4f369a48 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/Flow_Image_4.jpg differ diff --git a/samples/flow-excel-groupbyemail-notification-example/assets/workitems.xlsx b/samples/flow-excel-groupbyemail-notification-example/assets/workitems.xlsx new file mode 100644 index 00000000..ed08aed2 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/assets/workitems.xlsx differ diff --git a/samples/flow-excel-groupbyemail-notification-example/solution/flow-excel-groupbyemail-notification-example.zip b/samples/flow-excel-groupbyemail-notification-example/solution/flow-excel-groupbyemail-notification-example.zip new file mode 100644 index 00000000..a85d9439 Binary files /dev/null and b/samples/flow-excel-groupbyemail-notification-example/solution/flow-excel-groupbyemail-notification-example.zip differ diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/Other/Customizations.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Other/Customizations.xml new file mode 100644 index 00000000..5a421961 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Other/Customizations.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + Excel Online (Business) PowerAutomateSamples + /providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness + 1 + 0 + 0 + 1 + + + Office 365 Outlook PowerAutomateSamples + /providers/Microsoft.PowerApps/apis/shared_office365 + 1 + 0 + 0 + 1 + + + SharePoint PowerAutomateSamples + /providers/Microsoft.PowerApps/apis/shared_sharepointonline + 1 + 0 + 0 + 1 + + + + 1033 + + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/Other/Solution.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Other/Solution.xml new file mode 100644 index 00000000..0f292756 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Other/Solution.xml @@ -0,0 +1,87 @@ + + + + flowexcelgroupbyemailnotificationexample + + + + + 1.0.0.7 + 2 + + GernaeySoftwareLLC + + + + + + + michael@gernaey.com + https://gernaeysoftware.com + gsllc + 88103 + +
+ 1 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+ 2 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+
+ + + + +
+
\ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json new file mode 100644 index 00000000..9284188e --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json @@ -0,0 +1,600 @@ +{ + "properties": { + "connectionReferences": { + "shared_office365-1": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "gsllc_sharedoffice365_d6869" + }, + "api": { + "name": "shared_office365" + } + }, + "shared_sharepointonline-2": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "gsllc_sharedsharepointonline_7584d" + }, + "api": { + "name": "shared_sharepointonline" + } + }, + "shared_excelonlinebusiness-1": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "gsllc_sharedexcelonlinebusiness_055aa" + }, + "api": { + "name": "shared_excelonlinebusiness" + } + } + }, + "definition": { + "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "$connections": { + "defaultValue": {}, + "type": "Object" + }, + "$authentication": { + "defaultValue": {}, + "type": "SecureObject" + }, + "Notification_Email_Address (gsllc_Notification_Email_Address)": { + "defaultValue": "mgern@hotmail.com", + "type": "String", + "metadata": { + "schemaName": "gsllc_Notification_Email_Address", + "description": "Here you should input your operations email" + } + }, + "Source_SharePoint_Url (gsllc_Source_SharePoint_Url)": { + "defaultValue": "https://gernaey.sharepoint.com/sites/TheGernaeyCode", + "type": "String", + "metadata": { + "schemaName": "gsllc_Source_SharePoint_Url", + "description": "The URL that the excel file first lands in" + } + }, + "Attachment_File_Creation_Folder (gsllc_Attachment_File_Creation_Folder)": { + "defaultValue": "/ExcelExamples/GroupBy/WorkItems", + "type": "String", + "metadata": { + "schemaName": "gsllc_Attachment_File_Creation_Folder", + "description": "This is where you will save the incoming attachment" + } + }, + "Excel_File_Location_Uri_For_List_Rows (gsllc_Excel_File_Location_Uri_For_List_Rows)": { + "defaultValue": "GroupBy/WorkItems/", + "type": "String", + "metadata": { + "schemaName": "gsllc_Excel_File_Location_Uri_For_List_Rows", + "description": "Used in the List Rows Action" + } + }, + "Target_SharePoint_Url (gsllc_Target_SharePoint_Url)": { + "defaultValue": "https://gernaey.sharepoint.com/sites/TheGernaeyCode", + "type": "String", + "metadata": { + "schemaName": "gsllc_Target_SharePoint_Url", + "description": "The target SharePoint Site that file gets moved too" + } + }, + "SharePoint_Processed_Folder_Target_Location (gsllc_SharePoint_Processed_File_Target_Location)": { + "defaultValue": "/ExcelExamples/GroupBy/Processed", + "type": "String", + "metadata": { + "schemaName": "gsllc_SharePoint_Processed_File_Target_Location", + "description": "This is the folder path it will be saved in" + } + }, + "Excel_Table_Name (gsllc_Excel_Table_Name)": { + "defaultValue": "WorkItems", + "type": "String", + "metadata": { + "schemaName": "gsllc_Excel_Table_Name", + "description": "THe name of the table that has your data in excel" + } + }, + "Excel_Attachment_Name (gsllc_Excel_Attachment_Name)": { + "defaultValue": "workitems.xlsx", + "type": "String", + "metadata": { + "schemaName": "gsllc_Excel_Attachment_Name", + "description": "The name of the attachment" + } + }, + "Email_Subject_Filter_String (gsllc_Email_Subject_Filter_String)": { + "defaultValue": "WorkItems", + "type": "String", + "metadata": { + "schemaName": "gsllc_Email_Subject_Filter_String", + "description": "The string to filter in the subject for our emails" + } + }, + "SharePoint_Document_Library_Metadata_Id (gsllc_SharePoint_Document_Library_Metadata_Id)": { + "defaultValue": "b!GIfmRAVVw0mcFoQzYGhW-r3_yytMP19AvCd-ZdKecbLx0LomIb1QQJRqbnEl1-ia", + "type": "String", + "metadata": { + "schemaName": "gsllc_SharePoint_Document_Library_Metadata_Id", + "description": "The metadata ID of the sharepoint point folder for List Rows Actions" + } + } + }, + "triggers": { + "When_a_new_email_arrives_(V3)_-_Process_Incoming_WorkItems": { + "splitOn": "@triggerOutputs()?['body/value']", + "metadata": { + "operationMetadataId": "b1a0f5a5-b9db-4e7a-a95e-b9c2f59bd01b" + }, + "type": "OpenApiConnectionNotification", + "inputs": { + "host": { + "connectionName": "shared_office365-1", + "operationId": "OnNewEmailV3", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "folderPath": "Inbox", + "includeAttachments": true, + "subjectFilter": "WorkItems", + "importance": "Any", + "fetchOnlyWithAttachment": true + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "actions": { + "Verify_our_attachment_name_subject_and_that_we_only_have_1_attachment": { + "actions": { + "Try": { + "actions": { + "Compose_file_name_with_additional_date_and_time_details": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "08e19c16-16b8-4ce8-a8af-a0e52f01cfa3" + }, + "type": "Compose", + "inputs": "@concat(split(triggerOutputs()?['body/attachments']?[0]?['name'], '.')[0], '_', formatDateTime(utcNow(), 'dd_MM_yyyy__hh_mm_ss_fffZ'),'.xlsx')" + }, + "Is_the_Attachment_Inline_to_the_Body": { + "actions": { + "Get_Attachment_(V2)_-_Was_not_inline": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "3cf77a83-ad0b-43de-960e-7adf3fd31b49" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365-1", + "operationId": "GetAttachment_V2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "messageId": "@triggerOutputs()?['body/id']", + "attachmentId": "@triggerOutputs()?['body/attachments']?[0]?['id']", + "extractSensitivityLabel": false, + "fetchSensitivityLabelMetadata": false + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": { + "Compose_file_name_with_additional_date_and_time_details": [ + "Succeeded" + ] + }, + "else": { + "actions": { + "We_will_ignore_inLine_attachments_as_it_will_include_additional_work": { + "actions": {}, + "runAfter": {}, + "metadata": { + "operationMetadataId": "43b05641-729f-433e-832d-4d6da72130e8" + }, + "type": "Scope" + } + } + }, + "expression": { + "equals": [ + "@triggerOutputs()?['body/attachments']?[0]?['isInline']", + "@false" + ] + }, + "metadata": { + "operationMetadataId": "a1d30696-e4a9-4df7-8831-810a3a1127d9" + }, + "type": "If" + }, + "Create_our_New_Excel_File_in_the_WorkItems_folder_of_Sharepoint": { + "runAfter": { + "Is_the_Attachment_Inline_to_the_Body": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "413d41fb-536e-4ec3-bb29-809fce014328" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline-2", + "operationId": "CreateFile", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Source_SharePoint_Url (gsllc_Source_SharePoint_Url)')", + "folderPath": "@parameters('Attachment_File_Creation_Folder (gsllc_Attachment_File_Creation_Folder)')", + "name": "@outputs('Compose_file_name_with_additional_date_and_time_details')", + "body": "@outputs('Get_Attachment_(V2)_-_Was_not_inline')?['body/contentBytes']" + }, + "authentication": "@parameters('$authentication')" + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "List_all_Rows_in_our_WorkItems_Sheet": { + "runAfter": { + "Create_our_New_Excel_File_in_the_WorkItems_folder_of_Sharepoint": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "b1f08d9a-3609-4ddf-9cc7-b9a88c37d8d9", + "tableId": "@parameters('Excel_Table_Name (gsllc_Excel_Table_Name)')" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_excelonlinebusiness-1", + "operationId": "GetItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness" + }, + "parameters": { + "source": "@parameters('Source_SharePoint_Url (gsllc_Source_SharePoint_Url)')", + "drive": "@parameters('SharePoint_Document_Library_Metadata_Id (gsllc_SharePoint_Document_Library_Metadata_Id)')", + "file": "@{parameters('Excel_File_Location_Uri_For_List_Rows (gsllc_Excel_File_Location_Uri_For_List_Rows)')}@{outputs('Compose_file_name_with_additional_date_and_time_details')}", + "table": "@parameters('Excel_Table_Name (gsllc_Excel_Table_Name)')" + }, + "authentication": "@parameters('$authentication')", + "retryPolicy": { + "type": "none" + } + } + }, + "Select_Out_Only_EmployeeEmail": { + "runAfter": { + "List_all_Rows_in_our_WorkItems_Sheet": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "bb6a1675-e736-4e7c-a3f7-78fb984909e3" + }, + "type": "Select", + "inputs": { + "from": "@outputs('List_all_Rows_in_our_WorkItems_Sheet')?['body/value']", + "select": "@item()?['EmployeeEmail']" + } + }, + "Create_Unique_List_of_EmployeeEmail_Addresses": { + "runAfter": { + "Select_Out_Only_EmployeeEmail": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6416b0fa-eb3b-44da-b135-2db9d159bc83" + }, + "type": "Compose", + "inputs": "@union(body('Select_Out_Only_EmployeeEmail'),body('Select_Out_Only_EmployeeEmail'))" + }, + "Loop_Through_and_Get_All_Rows_grouped_by_Unique_Email_Address": { + "foreach": "@outputs('Create_Unique_List_of_EmployeeEmail_Addresses')", + "actions": { + "Filter_Rows_of_Data_to_Only_Get_the_Current_Unique_Email_Address": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "1d3b1e07-7171-4ba2-9e57-21748076cb35" + }, + "type": "Query", + "inputs": { + "from": "@outputs('List_all_Rows_in_our_WorkItems_Sheet')?['body/value']", + "where": "@equals(item()?['EmployeeEmail'], items('Loop_Through_and_Get_All_Rows_grouped_by_Unique_Email_Address'))" + } + }, + "Create_HTML_table": { + "runAfter": { + "Filter_Rows_of_Data_to_Only_Get_the_Current_Unique_Email_Address": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "b0f86612-a72f-492d-b75c-5e622f310cd0" + }, + "type": "Table", + "inputs": { + "from": "@body('Filter_Rows_of_Data_to_Only_Get_the_Current_Unique_Email_Address')", + "format": "HTML" + } + }, + "Send_an_email_(V2)_-_send_the_html_table_to_the_employee": { + "runAfter": { + "Create_HTML_table": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "083ebff5-7c0e-4750-b300-b9421155f1d1" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365-1", + "operationId": "SendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/To": "@items('Loop_Through_and_Get_All_Rows_grouped_by_Unique_Email_Address')", + "emailMessage/Subject": "Your WorkItems for Today - @{formatDateTime(utcNow(), 'dd-MM-yyyy')}", + "emailMessage/Body": "

Hello,
\n
\nHere are your list of workitems
\n
\n@{body('Create_HTML_table')}
\n
\nSincerely,
\nYour Automation Center

", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": { + "Create_Unique_List_of_EmployeeEmail_Addresses": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "e3e87b19-23c4-4517-a672-8f30be8bfb50" + }, + "type": "Foreach" + }, + "Pause_the_flow_for_10_minutes_to_unlock_the_Excel_file": { + "runAfter": { + "Loop_Through_and_Get_All_Rows_grouped_by_Unique_Email_Address": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "66e25356-8f40-4421-ae79-5d93db4ebf99" + }, + "type": "Wait", + "inputs": { + "interval": { + "count": 10, + "unit": "Minute" + } + } + }, + "Move_file_-_Move_our_processed_file_to_the_Processed_Folder": { + "runAfter": { + "Pause_the_flow_for_10_minutes_to_unlock_the_Excel_file": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "348f0412-307d-4665-94cc-2932194ecef1" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline-2", + "operationId": "MoveFileAsync", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('Source_SharePoint_Url (gsllc_Source_SharePoint_Url)')", + "parameters/sourceFileId": "@outputs('Create_our_New_Excel_File_in_the_WorkItems_folder_of_Sharepoint')?['body/Id']", + "parameters/destinationDataset": "@parameters('Target_SharePoint_Url (gsllc_Target_SharePoint_Url)')", + "parameters/destinationFolderPath": "@parameters('SharePoint_Processed_Folder_Target_Location (gsllc_SharePoint_Processed_File_Target_Location)')", + "parameters/nameConflictBehavior": 2 + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "runAfter": {}, + "metadata": { + "operationMetadataId": "c45a861a-6ce6-4cec-b8c7-2754f150b98f" + }, + "type": "Scope" + }, + "Catch": { + "actions": { + "Send_an_email_(V2)_-_send_operations_the_failure_details": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "1576ba2f-1db8-438c-b4f1-6e14218e775f" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365-1", + "operationId": "SendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/To": "@parameters('Notification_Email_Address (gsllc_Notification_Email_Address)')", + "emailMessage/Subject": "File failed to process successfully - @{formatDateTime(utcNow(),'dd-MM-yyyy')}", + "emailMessage/Body": "

Hello,
\n
\nPlease see the following details as to why the flow failed.
\n
\n@{result('Try')}
\n
\nSincerely,
\nThe Automation Team

", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Failed_for_cause": { + "runAfter": { + "Send_an_email_(V2)_-_send_operations_the_failure_details": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "f5a11da4-097a-425f-8bc8-a95ac7b070dd" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Failed", + "runError": { + "code": "501", + "message": "Please check your email for failure reason" + } + } + } + }, + "runAfter": { + "Try": [ + "TimedOut", + "Skipped", + "Failed" + ] + }, + "metadata": { + "operationMetadataId": "1999ace5-2a7a-4eb9-a222-b45559080d99" + }, + "type": "Scope" + }, + "Success": { + "actions": { + "Send_an_email_(V2)_-_Notify_operations_the_file_succeeded": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "96b15b9a-615c-4297-bd5a-b76bbbf052d2" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365-1", + "operationId": "SendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/To": "@parameters('Notification_Email_Address (gsllc_Notification_Email_Address)')", + "emailMessage/Subject": "File Completed Successfully - @{formatDateTime(utcNow(),'dd-MM-yyyy')}", + "emailMessage/Body": "

Hello,
\n
\nThis is just to let you know the file processed successfully today.
\n
\nSincerely,
\nThe Automation Team

", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Succeeded": { + "runAfter": { + "Send_an_email_(V2)_-_Notify_operations_the_file_succeeded": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "90e1876d-3f45-415e-8151-d4bffe85c2fe" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Succeeded" + } + } + }, + "runAfter": { + "Try": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "9179578f-77c6-4a83-8e9e-ac8cd6d16333" + }, + "type": "Scope" + } + }, + "runAfter": {}, + "else": { + "actions": { + "Send_an_email_(V2)_-_notify_operations_we_did_not_process_a_file": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "c2a4dc30-d33f-4f17-b5f0-56814e7e3a6b" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_office365-1", + "operationId": "SendEmailV2", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365" + }, + "parameters": { + "emailMessage/To": "@parameters('Notification_Email_Address (gsllc_Notification_Email_Address)')", + "emailMessage/Subject": "A file was not processed successfully due to unknown error - @{formatDateTime(utcNow(),'dd-MM-yyyy')}", + "emailMessage/Body": "

Hello,
\n
\nThis is to inform you that a file was either not found or some other issue, caused us not to process a file at all.
\n
\nSincerely,
\nThe Automation Team

", + "emailMessage/Importance": "Normal" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Failed_due_to_unknown_cause": { + "runAfter": { + "Send_an_email_(V2)_-_notify_operations_we_did_not_process_a_file": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "55ef5503-391e-4027-9b0a-0d2d6d1f3ec1" + }, + "type": "Terminate", + "inputs": { + "runStatus": "Failed", + "runError": { + "code": "500", + "message": "Attachment, Subject or Has Attachments Failed" + } + } + } + } + }, + "expression": { + "and": [ + { + "equals": [ + "@length(triggerOutputs()?['body/attachments'])", + 1 + ] + }, + { + "equals": [ + "@triggerOutputs()?['body/attachments']?[0]?['name']", + "@parameters('Excel_Attachment_Name (gsllc_Excel_Attachment_Name)')" + ] + }, + { + "equals": [ + "@toLower(triggerOutputs()?['body/subject'])", + "@toLower(parameters('Email_Subject_Filter_String (gsllc_Email_Subject_Filter_String)'))" + ] + }, + { + "equals": [ + "@triggerOutputs()?['body/hasAttachments']", + "@true" + ] + } + ] + }, + "metadata": { + "operationMetadataId": "ee421e9a-dad6-46b8-9cf1-65cfa81172cf" + }, + "type": "If" + } + } + }, + "templateName": "" + }, + "schemaVersion": "1.0.0.0" +} \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json.data.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json.data.xml new file mode 100644 index 00000000..90c8db03 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json.data.xml @@ -0,0 +1,26 @@ + + + /Workflows/TheGernaeyCodeExcelGroupByEmployeeNotifications-DA8884B2-4E60-F011-BEC2-6045BDEF61CA.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 1.0.0.0 + 1 + 1 + 0 + none + + + + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Attachment_File_Creation_Folder/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Attachment_File_Creation_Folder/environmentvariabledefinition.xml new file mode 100644 index 00000000..534dc45e --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Attachment_File_Creation_Folder/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Email_Subject_Filter_String/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Email_Subject_Filter_String/environmentvariabledefinition.xml new file mode 100644 index 00000000..0d86f049 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Email_Subject_Filter_String/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_Attachment_Name/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_Attachment_Name/environmentvariabledefinition.xml new file mode 100644 index 00000000..5c935b99 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_Attachment_Name/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_File_Location_Uri_For_List_Rows/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_File_Location_Uri_For_List_Rows/environmentvariabledefinition.xml new file mode 100644 index 00000000..2a16346b --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_File_Location_Uri_For_List_Rows/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_Table_Name/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_Table_Name/environmentvariabledefinition.xml new file mode 100644 index 00000000..67ce6622 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Excel_Table_Name/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Notification_Email_Address/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Notification_Email_Address/environmentvariabledefinition.xml new file mode 100644 index 00000000..dd00ad45 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Notification_Email_Address/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_SharePoint_Document_Library_Metadata_Id/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_SharePoint_Document_Library_Metadata_Id/environmentvariabledefinition.xml new file mode 100644 index 00000000..b1b7a27c --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_SharePoint_Document_Library_Metadata_Id/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_SharePoint_Processed_File_Target_Location/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_SharePoint_Processed_File_Target_Location/environmentvariabledefinition.xml new file mode 100644 index 00000000..34e7de01 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_SharePoint_Processed_File_Target_Location/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Source_SharePoint_Url/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Source_SharePoint_Url/environmentvariabledefinition.xml new file mode 100644 index 00000000..063a5af5 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Source_SharePoint_Url/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file diff --git a/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Target_SharePoint_Url/environmentvariabledefinition.xml b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Target_SharePoint_Url/environmentvariabledefinition.xml new file mode 100644 index 00000000..0146e3a1 --- /dev/null +++ b/samples/flow-excel-groupbyemail-notification-example/sourcecode/environmentvariabledefinitions/gsllc_Target_SharePoint_Url/environmentvariabledefinition.xml @@ -0,0 +1,13 @@ + + + + + + 1.0.0.4 + 1 + 0 + 0 + 100000000 + \ No newline at end of file