locked
Unable to extract the json file attached via email from the LOGIC APPS RRS feed

  • Question

  • Hello Everyone,

    Need help on this...

    I am using Azure Logic Apps to extract JSON file which is attached email. Unable to find the file after using the attachment file.

    All the values after JSON mapping are coming as null. 

    Thanks

    Prabhas

     
    Thursday, March 21, 2019 1:27 PM

Answers

  • Hi Prabhas,

    You are missing setting up trigger property to include attachment and thats the reason you are getting null content for the attachment .

    Below workflow definition will help you to resolve your issue 

    {
            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
            "actions": {
                "For_each": {
                    "actions": {
                        "HTTP": {
                            "inputs": {
                                "body": "@base64toString(items('For_each')?['ContentBytes'])",
                                "method": "POST",
                                "uri": "http://requestbin.fullcontact.com/1m4xtv22"
                            },
                            "runAfter": {},
                            "type": "Http"
                        }
                    },
                    "foreach": "@triggerBody()?['Attachments']",
                    "runAfter": {},
                    "type": "Foreach"
                }
            },
            "contentVersion": "1.0.0.0",
            "outputs": {},
            "parameters": {
                "$connections": {
                    "defaultValue": {},
                    "type": "Object"
                }
            },
            "triggers": {
                "When_a_new_email_arrives": {
                    "inputs": {
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['outlook']['connectionId']"
                            }
                        },
                        "method": "get",
                        "path": "/Mail/OnNewEmail",
                        "queries": {
                            "fetchOnlyWithAttachment": true,
                            "folderPath": "Inbox",
                            "importance": "Any",
                            "includeAttachments": true
                        }
                    },
                    "recurrence": {
                        "frequency": "Minute",
                        "interval": 3
                    },
                    "splitOn": "@triggerBody()?['value']",
                    "type": "ApiConnection"
                }
            }
        }

    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Friday, March 22, 2019 2:48 AM

All replies

  • Hi Prabhas,

    You are missing setting up trigger property to include attachment and thats the reason you are getting null content for the attachment .

    Below workflow definition will help you to resolve your issue 

    {
            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
            "actions": {
                "For_each": {
                    "actions": {
                        "HTTP": {
                            "inputs": {
                                "body": "@base64toString(items('For_each')?['ContentBytes'])",
                                "method": "POST",
                                "uri": "http://requestbin.fullcontact.com/1m4xtv22"
                            },
                            "runAfter": {},
                            "type": "Http"
                        }
                    },
                    "foreach": "@triggerBody()?['Attachments']",
                    "runAfter": {},
                    "type": "Foreach"
                }
            },
            "contentVersion": "1.0.0.0",
            "outputs": {},
            "parameters": {
                "$connections": {
                    "defaultValue": {},
                    "type": "Object"
                }
            },
            "triggers": {
                "When_a_new_email_arrives": {
                    "inputs": {
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['outlook']['connectionId']"
                            }
                        },
                        "method": "get",
                        "path": "/Mail/OnNewEmail",
                        "queries": {
                            "fetchOnlyWithAttachment": true,
                            "folderPath": "Inbox",
                            "importance": "Any",
                            "includeAttachments": true
                        }
                    },
                    "recurrence": {
                        "frequency": "Minute",
                        "interval": 3
                    },
                    "splitOn": "@triggerBody()?['value']",
                    "type": "ApiConnection"
                }
            }
        }

    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Friday, March 22, 2019 2:48 AM
  • Thanks for the quick

    Just one more thing.

    It is strange though, the step of the COSMOS DB "Create or update document" is getting passed but I am unable to see the document in DB collection. But the step it is passed. 



    Friday, March 22, 2019 7:54 AM