introduction

Power Apps (Canvas) enables file uploads to SharePoint by using Microsoft Graph APIs. By combining an Attachment control with a Graph PUT request, files can be securely uploaded to a SharePoint document library (Drive), providing a flexible alternative to standard SharePoint connectors

✅ Power Apps Canvas – Upload Attachments to SharePoint via Graph

Scenario:

🔹 Working Power Fx Code on Upload button

ForAll(
    AttachmentControl.Attachments As FileAttachment,
    Office365Groups.HttpRequest(
        "https://graph.microsoft.com/v1.0/sites/{SITE-ID}/drives/{DRIVE-ID}/root:/" &
        FileAttachment.Name &
        ":/content",
        "PUT",
        FileAttachment.Value
    )
);

Reset(AttachmentControl);

🔹 Add Office365Groups

TinyTake27-01-2026-07-08-24

🔹Flow through to get SiteID

TinyTake27-01-2026-07-12-32TinyTake27-01-2026-07-23-29Screenshot 2026-01-27 184705

🔹Find a SharePoint document library DRIVE ID

Step 1: Open Graph Explorer

👉 https://aka.ms/ge

Step 2: List document libraries (drives)

GET https://graph.microsoft.com/v1.0/sites/{SITE-ID}/drives

Response example:

{
  "value": [
    {
      "id": "b!1sgLgNpL7EC2Hr7BleZb25UIxcUghT1Cg9_fHTLzaLfP4GPK7osMQrEDSvsGBHl-",
      "name": "Documents"
    },
    {
      "id": "b!abc123...",
      "name": "Shared Documents"
    }
  ]
}

👉 The id next to the library name you want = DRIVE ID

Sign in with the same account you use in Power Apps.

🔹 Replace These Values

PlaceholderDescription
{SITE-ID}SharePoint Site ID
{DRIVE-ID}Document Library Drive ID
AttachmentControlYour attachment control name

🔹 Upload to a Folder

/root:/Folder1/SubFolder2/" & A.Name & ":/content

⚠️ Folder must already exist — Graph won’t create it.

🔐 Required Permissions

Your Power Apps connection must include:

(Granted automatically via the Office 365 Groups connector, but admin consent may be required.)

⚠️ Important Limits

ItemLimit
File size4 MB max
Upload methodSimple upload only
Folder creationNot supported
Overwrite behaviorReplaces existing file

🔄 For Files Larger Than 4 MB

You must use Upload Sessions:

POST /drive/root:/filename:/createUploadSession

Power Apps cannot do chunked uploads natively, so you’ll need:

🧪 Debug Tip

Wrap in IfError() to catch failures:

IfError(
    Office365Groups.HttpRequest(...),
    Notify("Upload failed", NotificationType.Error)
)

Conclusion

  1. Add an Attachment control in the Canvas app.

  2. Get the SharePoint Site ID using Microsoft Graph.

  3. Identify the document library Drive ID.

  4. Build the Graph upload URL using Site ID + Drive ID.

  5. Loop through attachments using ForAll().

  6. Upload each file with a PUT request via Office365Groups.HttpRequest.

  7. Send file content as binary with Content-Type: application/octet-stream.

  8. Ensure required Graph permissions are granted.

  9. Reset the attachment control after upload.

  10. Use Power Automate for files larger than 4 MB.