web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot parse content b...
Power Automate
Unanswered

Cannot parse content bytes from blob correctly

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all, I am building a flow with azure blob storage and outlook email. Firstly, I get the content of a blob from storage account; it should be a json file, and it contains an attachment array:

"AttachmentsPower": {
            "type""array",
            "items": {
                "type""object",
                "properties": {
                    "Name": {
                        "type""string"
                    },
                    "ContentBytes": {
                        "type""string"
                    }
                },
                "required": [
                    "Name",
                    "ContentBytes"
                ]
            }
        }

Then I try to set it as attachment of my email, the whole flow is like this:

X1ng_0-1653466355499.png

However, I found the attachment sent in the email is not the same as the original one. For examle, I uploaded a test.txt to blob and it content is "test test test范德萨发大水"; while I got a test.txt from email whose content is "dGVzdCB0ZXN0IHRlc3TojIPlvrfokKjlj5HlpKfmsLQ=". I am guessing I need to do some decode but I don't know how to do it. I searched a lot but found no result. Could anyone please help me out?

 

Categories:
I have the same question (0)
  • ashyriverflow Profile Picture
    128 on at

    Hi @X1ng , the action Get blob content (V2) is able to get the content of a text file without the need of decoding it.

    ashyriverflow_0-1653469328097.png

    Can you explain more what you meant by "it should be a json file..."?

  • X1ng Profile Picture
    Microsoft Employee on at

    Hi @ashyriverflow, thanks for answering. The content of the blob file is a json file:

    {
        "type""object",
        "properties": {
            "BodyPower": {
                "type""string"
            },
            "AttachmentsPower": {
                "type""array",
                "items": {
                    "type""object",
                    "properties": {
                        "Name": {
                            "type""string"
                        },
                        "ContentBytes": {
                            "type""string"
                        }
                    },
                    "required": [
                        "Name",
                        "ContentBytes"
                    ]
                }
            }
        }
    }

    It has two fields, bodyPower and attachmentsPower. The body Power is text for email body, and it works well now. However, attachmentsPower is an array, and has two fields for each element -- Name and ContentBytes (which are consistent with attachement array for email). It could have several different type of files, such as .txt, .png, .tsv, etc.. If I directly use the array in email connector:

    X1ng_0-1653472424243.png

    The files I received from email are not correct. That's why I am thinking maybe I need to decode them or something.

     

  • Verified answer
    ashyriverflow Profile Picture
    128 on at

    Hi @X1ng , in the Flow run, what is the returned value of ContentBytes in the Get Blob Entity action?

    If it's also "dGVzdCB0ZXN0IHRlc3TojIPlvrfokKjlj5HlpKfmsLQ=", then base64tostring() is needed but only for the ContentBytes property, not the whole AttachmentsPower.

    You might need to reconstruct AttachmentsPower object with the new decoded - this one is a bit tricky though.

  • X1ng Profile Picture
    Microsoft Employee on at

    Thanks, @ashyriverflow.

    I decoded the ContentBytes and it works.

    The additional part of flow is like this:

    X1ng_0-1653486003653.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard