Search code examples
outlookmicrosoft-graph-apioffice365power-automate

My Power Automate email has no attachment contents


I'm currently developing a little power automate script to check email sent to my inbox to copy their file attachments into a sharepoint directory. The first step works well, but when I try to access the ContentBytes property of the attachment, I get a null result, no matter what I do.

Debugging the problem further, I can inspect the json representation of the email, more specifically the attachment part of it :

        "attachments": [
            {
                "@odata.type": "#microsoft.graph.fileAttachment",
                "id": "ABCDEFGHIJxN2YxZDY4LTg2NGUtNGFlZC05MjkxLTk1YmNmYTExNGMwYQBGAAAAAAB1UPP0g57US79cXWoM-hy1BwBhkDNeBn4nSJmQYzPajI3HAAFQsVWPAABhkDNeBn4nSJmQYzPajI3HAASUk_4TAAABEgAQACblboGchHNFiYfGDjE7atU=",
                "lastModifiedDateTime": "2024-05-22T02:41:24+00:00",
                "name": "Myfile.xlsx",
                "contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                "size": 184602,
                "isInline": false
            }
        ]

And sure enough, there are no ContentBytes property, despite what the docs are implying.

So my question is, how can I retrieve the content of these attachement in a Power Bi environment.

Thank you !


Solution

  • Turns out all I needed was to turn on the IncludeAttachments in the Power Automate task. I only had the fetchOnlyWithAttachment option turned on.