skip to Main Content

Hello I have a logic app that looks for email attachments, I made an HTTP request to upload this file into a temporary blob storage. When I open my pdf file it is empty.

enter image description here

I have a variable where I put the file content and send it as body in the HTTP Request and It looks like this

enter image description here

I need to upload any type of files and I am getting this problem only with files that are not text

2

Answers


  1. I have reproduced in my environment and got expected results as below:

    Design:

    You have connector called as Azure blob Storage (In that connector you can use action called as Create blob (V2) like below):

    enter image description here

    Output:

    enter image description here

    In storage account:

    enter image description here

    Codeview:

    {
        "definition": {
            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
            "actions": {
                "Create_blob_(V2)": {
                    "inputs": {
                        "body": "@variables('var1')",
                        "headers": {
                            "ReadFileMetadataFromServer": true
                        },
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['azureblob_1']['connectionId']"
                            }
                        },
                        "method": "post",
                        "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files",
                        "queries": {
                            "folderPath": "/rithwik",
                            "name": "rithblob",
                            "queryParametersSingleEncoded": true
                        }
                    },
                    "runAfter": {
                        "Initialize_variable": [
                            "Succeeded"
                        ]
                    },
                    "runtimeConfiguration": {
                        "contentTransfer": {
                            "transferMode": "Chunked"
                        }
                    },
                    "type": "ApiConnection"
                },
                "Initialize_variable": {
                    "inputs": {
                        "variables": [
                            {
                                "name": "var1",
                                "type": "string",
                                "value": " ۝ $u0011 W$H: A   XPg   ku0003u0001v i 8 u001c  K5uu0003   G ƥ֋u001d B p  b  \  nړ1  $N ;u000e _xu0011  /  u0001t u0006u0003*u001b-Nu001cP`  @ ,p zOW5 絒 u001au000e' u0006 u0004u000b Ru000e Z p  u0015 C au0017   fn ! 6z3  3  n/ = > u0005  w@  u001eX?  u0017    O  `  & .  _iΓi n     +u000f  Hj2_" k +u000ef  ç   U  u0006 sտu0013j/  .򌿸 o : P W O  95  T $ug  u001fZBm / Cu000eu0016詷U пb  [u0011 ʒnu000f E %gW#   -n AV//gJ' u0014~  -u0004 u0015  u001c tpi   ͟[qʍi   o  u001e u001e abu0001["
                            }
                        ]
                    },
                    "runAfter": {},
                    "type": "InitializeVariable"
                }
            },
            "contentVersion": "1.0.0.0",
            "outputs": {},
            "parameters": {
                "$connections": {
                    "defaultValue": {},
                    "type": "Object"
                }
            },
            "triggers": {
                "manual": {
                    "inputs": {
                        "schema": {}
                    },
                    "kind": "Http",
                    "type": "Request"
                }
            }
        },
        "parameters": {
            "$connections": {
                "value": {
                    "azureblob_1": {
                        "connectionId": "/subscriptions/b83c1ed3/resourceGroups/vrbojja/providers/Microsoft.Web/connections/azureblob-1",
                        "connectionName": "azureblob-1",
                        "id": "/subscriptions/b83c1ed3/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
                    }
                }
            }
        }
    }
    
    Login or Signup to reply.
  2. You can do this:

    Create a Logic App that looks like this, meaning that you need to have a storage account and a container where you will store the files

    If you do not have a container simply create one

    Next as you can see I am sending an email with a PDF attachment from a google account to a outlook one.

    And here you can see that I have received it in Outlook

    So now the Logic App will run since it expects for emails with attachments, and if you now check your blob container you can see that you have the file there, after downloading it, you will see that it is intact.

    Hope this helps, if you need more assistance just let me know. (no reputation points yet, just started to contribute in stack overflow recently so i can only share 8 links, no images if this helped you please upvote it 🙂 )

    01

    02

    03

    04

    05

    06

    07

    08

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search