7 month Saga Email attachment issue
Logic app automation to send multiple messages after the hr emails coming in
1.curly braces > not square braces
2.base64 > not direct
3.Use the office365 connector > not gmail one
4.use folders for each use case > not individually selected



Code
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Append_to_array_variable": {
"inputs": {
"name": "attachments",
"value": {
"ContentBytes": "@{base64(body('Get_blob_content_using_path_(V2)'))}",
"Name": "@{items('For_each')?['DisplayName']}"
}
},
"runAfter": {
"Get_blob_content_using_path_(V2)": [
"Succeeded"
]
},
"type": "AppendToArrayVariable"
},
"Get_blob_content_using_path_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/GetFileContentByPath",
"queries": {
"inferContentType": true,
"path": "@items('For_each')?['Path']",
"queryParametersSingleEncoded": true
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "@body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "attachments",
"type": "array",
"value": []
}
]
},
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmZW1haWxz'))}",
"queries": {
"useFlatListing": false
}
},
"metadata": {
"JTJmZW1haWxz": "/emails"
},
"runAfter": {},
"type": "ApiConnection"
},
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Attachments": "@variables('attachments')",
"Body": "<p>xxx</p>",
"Importance": "Normal",
"Subject": "u1",
"To": "[email protected]"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/resourceGroups/sendemailattachmentssupport_group/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
},
"office365": {
"connectionId": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/resourceGroups/sendemailattachmentssupport_group/providers/Microsoft.Web/connections/office365",
"connectionName": "office365",
"id": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/providers/Microsoft.Web/locations/eastus/managedApis/office365"
}
}
}
}
}
Imported from rifaterdemsahin.com · 2023