Back to all posts
PowerApps

Convert Attachments to Base64 in Power Apps

April 22, 20266 min read
Convert Attachments to Base64 in Power Apps

Working with attachments in Power Apps can be… frustrating.

At first, everything seems simple.

Upload a file. Done.

But the moment you need to do something more advanced…

👉 you hit the limits.

The Problem

The default Attachments control is very limited.

You quickly run into issues like:

❌ Hard to send files to APIs

❌ Tightly coupled with SharePoint

❌ Limited control over file content

And that becomes a blocker.

Why This Matters

In real-world apps, you often need to:

  • send files to external APIs
  • store them in Azure
  • process them in a custom backend

👉 And for that, you need full control over the file data.

The Idea: Convert to Base64

Instead of relying on the default behavior:

👉 Convert the file to Base64

This gives you:

✔ full control over the content

✔ ability to send files anywhere (API, SQL, Azure)

✔ independence from SharePoint

Step 1: Add Attachment Control

Start by adding an Attachment control to your app.

Image1

If you can’t find it:

💡 It’s only available inside forms.

Workaround

  1. Create an Edit Form
  2. Connect it to any datasource (temporary is fine)
  3. Add the Attachments field
  4. Copy the control
  5. Paste it into your screen

Step 2: Get Attachment Content

Now you need to access the file content.

A simple trick is to use an Image control (hidden).

Image2

Set its Image property to:

First(AttachmentControl.Attachments).Value

Image3

👉 This gives you access to the binary content of the file.

Step 3: Convert to JSON

Next, convert the file into JSON format:

JSON(
    ImageControl.Image,
    JSONFormat.IncludeBinaryData
)

This returns a string that includes metadata + Base64.

Step 4: Extract Base64 Only

Now extract just the Base64 part:

Set(
    varBase64Only,
    Mid(
        varAttachmentJson,
        Find(",", varAttachmentJson) + 1,
        Len(varAttachmentJson) - Find(",", varAttachmentJson) - 1
    )
)

👉 Now you have clean Base64 data.

Step 5: Use It Anywhere

With varBase64Only, you can:

  • send files to APIs
  • store them in Azure Blob Storage
  • pass them to Power Automate
  • save them in SQL

Image4

What You Get

Once you implement this approach:

✅ Send attachments to any API

✅ Works with Azure or custom backend

✅ Full flexibility using Base64

Why This Is Powerful

This removes one of the biggest limitations in Power Apps.

You are no longer tied to:

  • SharePoint attachments
  • built-in constraints

You control the file—not the platform.

Final Thoughts

Handling attachments properly unlocks a lot of possibilities.

It turns Power Apps from a simple form tool…

Into a real integration platform.

The Rule to Remember

If you need flexibility with files, convert them to Base64.

One Question

How are you handling attachments in your apps today? 👇

#PowerApps #PowerPlatform #LowCode #Microsoft #Automation #AppDevelopment #Integration #Azure #DevelopmentTips #SoftwareArchitecture