Adrian Torrie
Adrian Torrie

Reputation: 2844

Azure Logic App - On New Email - Attachments have null bytes

Why aren't the attachments being read correctly?


Trying to use the quick-start template for saving attachments in emails to a SharePoint folder.

Workflow:

On new email > Outputs > Attachments

On new mail appears to succeed, but the content of the attachments is set to null ("ContentBytes": null):

[
  {
    "Id": "AAMkADlhMDBiODNiLWFmOTEtNGZjOS1hMjYxLTY1OTU3MDk4YzZjNABGAAAAAACijX5OkcblRIVMFzOsYgiSBwBFaJ_hCA08Tb5SmdY6ZqCxAAAAADB8AABFaJ_hCA08Tb5SmdY6ZqCxAACD6w2UAAABEgAQAOCw7xb1bG9LstW5SRafEOE=",
    "ContentType": "image/jpeg",
    "Size": 16962,
    "@odata.type": "#Microsoft.OutlookServices.FileAttachment",
    "Name": "image001.jpg",
    "ContentBytes": null
  },
  {
    "Id": "AAMkADlhMDBiODNiLWFmOTEtNGZjOS1hMjYxLTY1OTU3MDk4YzZjNABGAAAAAACijX5OkcblRIVMFzOsYgiSBwBFaJ_hCA08Tb5SmdY6ZqCxAAAAADB8AABFaJ_hCA08Tb5SmdY6ZqCxAACD6w2UAAABEgAQAG7KUOVpzCRJslBYmXAysB4=",
    "ContentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "Size": 194702,
    "@odata.type": "#Microsoft.OutlookServices.FileAttachment",
    "Name": "Test.docx",
    "ContentBytes": null
  },
  {
    "Id": "AAMkADlhMDBiODNiLWFmOTEtNGZjOS1hMjYxLTY1OTU3MDk4YzZjNABGAAAAAACijX5OkcblRIVMFzOsYgiSBwBFaJ_hCA08Tb5SmdY6ZqCxAAAAADB8AABFaJ_hCA08Tb5SmdY6ZqCxAACD6w2UAAABEgAQAL3JExHdzLJDs0YH1XpZXgU=",
    "ContentType": "image/jpeg",
    "Size": 73353,
    "@odata.type": "#Microsoft.OutlookServices.FileAttachment",
    "Name": "image005.jpg",
    "ContentBytes": null
  },
  {
    "Id": "AAMkADlhMDBiODNiLWFmOTEtNGZjOS1hMjYxLTY1OTU3MDk4YzZjNABGAAAAAACijX5OkcblRIVMFzOsYgiSBwBFaJ_hCA08Tb5SmdY6ZqCxAAAAADB8AABFaJ_hCA08Tb5SmdY6ZqCxAACD6w2UAAABEgAQABUsTq9cXiVCoowGEFnbtHw=",
    "ContentType": "image/jpeg",
    "Size": 3684,
    "@odata.type": "#Microsoft.OutlookServices.FileAttachment",
    "Name": "image003.jpg",
    "ContentBytes": null
  }
]

For-each container > Create file

Fails with the following:

InvalidTemplate. Unable to process template language expressions in action 'Create_file' inputs at line '1' and column '11': 'The template language function 'base64ToBinary' expects its parameter to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64ToBinary for usage details.'.

enter image description here

Upvotes: 2

Views: 2431

Answers (1)

jeffhollan
jeffhollan

Reputation: 3227

There's an "include attachments " option on the trigger to opt in to include bytes. Make sure that is turned on and it should work.

Upvotes: 5

Related Questions