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:
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?
Solved! Go to Solution.
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.
Hi @X1ng , the action Get blob content (V2) is able to get the content of a text file without the need of decoding it.
Can you explain more what you meant by "it should be a json file..."?
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:
The files I received from email are not correct. That's why I am thinking maybe I need to decode them or something.
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.
Thanks, @ashyriverflow.
I decoded the ContentBytes and it works.
The additional part of flow is like this: