Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Power Apps Modern Attachment Control: Save Files to SharePoint Without a Form

Our help desk wanted agents to attach a quote or a screenshot to any service request straight from a gallery. No form, no extra screen, just pick the request, drop the files and save.

In this tutorial, we’ll build that screen with the power apps modern attachment control. We’ll turn on modern controls, bind the control to a SharePoint gallery, set file limits and types, save with Patch, then test removing, undoing and resetting files.

Here’s what we’re building. The request on the left owns the two saved files on the right:

Finished Power Apps screen with the modern Attachments control showing saved files for a service request

Before You Start

You need edit rights on a SharePoint site and a Power Apps license that includes SharePoint, which most Microsoft 365 plans do. If galleries are new to you, read how to display SharePoint list items in Power Apps first.

The modern Attachments control is a preview feature. Microsoft says preview features aren’t meant for production use, so test it well before you roll it out.

I built this in my Service Desk Demo app on the SharePoint list Service Requests (620 items) on the /sites/SPGuides site. These are its columns:

NameTypeNotes
TitleSingle line of textLaptop replacement #1000
StatusChoiceNew
PriorityChoiceNot used on this screen
RequesterSingle line of textMegan Bowen
DueDate, RequestedOnText, MeetingStartDate / textNot used on this screen
AttachmentsBuilt-in list attachmentsTurned on for this list

Here’s the list in SharePoint:

SharePoint Service Requests list with 620 items used for the attachments demo

Step 1: Create the App and Connect the List

Skip this step if you already have a canvas app connected to the list. Otherwise, we’ll create a blank app and add the list as a data source, the place the app reads and writes records. The classic attachment control in Power Apps post uses the same list setup.

1. Go to make.powerapps.com. On Home, find Start with design:

Power Apps maker portal Home page with the Start with design options

2. Select Create in the left menu, then Create from blank for a canvas app:

Power Apps Create page with the Create from blank canvas app tile

3. In Start with a blank canvas, pick Tablet. Power Apps Studio opens:

Start with a blank canvas dialog with the Tablet layout selected

4. Select Add data, type SharePoint in the search box and pick the SharePoint connector:

Add data pane in Power Apps Studio searching for the SharePoint connector

5. Paste your site URL under Connect to a SharePoint site and select Connect:

Connect to a SharePoint site panel with the SPGuides site URL entered

6. Check Service Requests under Choose a list and select Connect:

Choose a list panel with the Service Requests list checked before Connect

Two tools come up in every step. The formula bar (marked fx) sits above the canvas. The property dropdown on its left picks which property you’re editing, such as Items or OnSelect. Press Ctrl+S to save the app often.

Checkpoint: Service Requests shows under Data in the left pane.

Step 2: Turn On Modern Controls

The Attachments control only shows up after you switch the app to modern controls. Our Power Apps modern controls guide covers the rest of the new control set.

  1. On the command bar, select Settings, then Updates.
  2. Open the New tab.
  3. Turn on Modern controls and themes and close the dialog.
Power Apps Settings Updates New tab with the Modern controls and themes toggle turned on

My app had this toggle off. After I turned it on, the command bar showed a Settings button where the old Theme button used to be.

Checkpoint: Modern controls and themes reads On.

Step 3: Add the Requests Gallery

The gallery is how the user picks which SharePoint item the files belong to.

  1. Rename the screen scrAttachments.
  2. Insert a Vertical gallery on the left and name it galAttRequests.
  3. With the gallery selected, choose Items in the property dropdown and type 'Service Requests' in the formula bar.
  4. In the first row, set one label’s Text to ThisItem.Title and a second label’s Text to the subtitle formula below.
  5. Add a label lblAttSelected above the control area with the selected-title formula.
// gallery subtitle label
ThisItem.Requester & "  |  " & ThisItem.Status.Value

// lblAttSelected.Text
"Selected: " & galAttRequests.Selected.Title

One gotcha I hit: my first try was Filter('Service Requests', ID <= 8) to keep the gallery short. Power Apps showed a yellow delegation warning, because that ID comparison isn’t delegable on SharePoint. Delegation means the data source does the filtering instead of the app. See Power Apps delegation warnings for the full fix list.

Using the whole list, 'Service Requests', gave no warning, so I kept it.

Checkpoint: the gallery shows Laptop replacement #1000 with Megan Bowen | New underneath.

Step 4: Insert the Modern Attachments Control

Now we add the control itself and point it at the selected request’s attachments.

  1. Open the Insert menu and type attach in the search box.
  2. Under Input, select Attachments. It carries a Preview badge.
Power Apps Insert menu search for attach showing the Attachments preview control under Input

Power Apps names it Attachments1. I renamed it attRequest in the tree view. Out of the box it allowed 10 files of up to 10 MB each, showed a footer, and read No attachments with an Attach file link.

Next, select the control, pick Items in the property dropdown and enter this formula:

galAttRequests.Selected.Attachments
Items property of the modern Attachments control set to galAttRequests.Selected.Attachments in the formula bar

Unlike the classic control, this one works outside a form. That’s the whole reason to use it on a gallery screen.

Checkpoint: the control lists the files already on the selected request, or shows No attachments.

Step 5: Set the File Limits and Accepted Types

Limits keep users from dropping a 40-file folder on one request.

  1. In the Properties pane, open the Display tab.
  2. Set Max attachments to 5 and Max attachment size to 10. The size is in MB, per new file.
Properties pane Display tab with Max attachments 5 and Max attachment size 10 boxed

Then open the Advanced tab, search for Accepted, and set AcceptedFileTypes to a table of extensions:

[".pdf", ".docx", ".png", ".jpg"]
Advanced tab AcceptedFileTypes property set to pdf, docx, png and jpg extensions

Here’s the full property list for attRequest, including the screen-reader label, the display mode and the error handler:

Items              = galAttRequests.Selected.Attachments
MaxAttachments     = 5
MaxAttachmentSize  = 10
AcceptedFileTypes  = [".pdf", ".docx", ".png", ".jpg"]
AccessibleLabel    = "Supporting files for the selected service request"
DisplayMode        = If(IsBlank(galAttRequests.Selected), DisplayMode.Disabled, DisplayMode.Edit)
OnError            = Notify(Self.LastError.Message, NotificationType.Error)

DisplayMode disables the control until a request is selected. OnError runs when adding a file fails. Prefer pasting? This YAML (the code format Power Apps uses for copy and paste) creates the same control:

- attRequest:
    Control: ModernAttachments@1.3.0
    Properties:
      Items: =galAttRequests.Selected.Attachments
      MaxAttachments: =5
      MaxAttachmentSize: =10
      AcceptedFileTypes: =[".pdf", ".docx", ".png", ".jpg"]
      AccessibleLabel: ="Supporting files for the selected service request"
      DisplayMode: =If(IsBlank(galAttRequests.Selected), DisplayMode.Disabled, DisplayMode.Edit)
      OnError: =Notify(Self.LastError.Message, NotificationType.Error)

Checkpoint: the Display tab shows 5 and 10, and AcceptedFileTypes lists four extensions.

Step 6: Save the Files With Patch

Adding a file only stages it in the app. Nothing reaches SharePoint until you save. Outside a form, that’s a Patch function call that writes the control’s Attachments output to the item.

  1. Insert a Button, name it btnSaveAttachments, and set its Text to Save attachments.
  2. Pick OnSelect in the property dropdown and paste the formula below.
  3. Expand the formula bar with the down arrow on its right so you can read the whole formula.
If(
    IsBlank(galAttRequests.Selected),
    Notify("Select a request before saving.", NotificationType.Warning),
    IfError(
        Patch(
            'Service Requests',
            galAttRequests.Selected,
            {Attachments: attRequest.Attachments}
        ); true,
        Notify("Attachments couldn't be saved. " & FirstError.Message, NotificationType.Error),
        Notify("Attachments saved.", NotificationType.Success)
    )
)
Save attachments button OnSelect formula with the Patch block boxed in the expanded formula bar

IfError catches a failed Patch and shows the reason, and the Power Apps Notify function shows the green or red banner. The ; true keeps IfError from treating a successful Patch as blank.

Add a file counter and a Discard button

Two small extras make testing easier. Add a label lblAttCount and a second button btnDiscardAttachments with these formulas:

// lblAttCount.Text
"Files in the control: " & attRequest.AttachmentsCount

// btnDiscardAttachments.OnSelect
Reset(attRequest)

Reset throws away unsaved changes and shows the request’s saved files again.

Checkpoint: the screen has the gallery, the control, Files in the control: 0 and two buttons.

Test the App

Select Preview (the play button at the top right) or press F5. In the editor, you can also hold Alt and select a button. Then select Laptop replacement #1000 (Megan Bowen, New).

I added Laptop-Quote-Oct-2026.pdf (635 B), VPN-Error-Screenshot.png (4.8 KB) and Warranty-Terms.docx (1.3 KB). Each row showed its size and Unsaved, and the footer read 3 attachments, 3 unsaved:

Three files added in the modern Attachments control, each marked Unsaved with its file size

The counter showed Files in the control: 3, and SharePoint had nothing yet. Then I selected Save attachments. The green banner read Attachments saved., the Unsaved tags disappeared, and the footer read 3 attachments.

Next, I selected the X on the saved PNG. It didn’t vanish. The name was struck through, marked Unsaved, and the X turned into an undo arrow:

Saved PNG marked for removal with strikethrough, Unsaved tag and an undo arrow in the Attachments control

The footer read 2 attachments, 1 unsaved, and the counter dropped to 2. AttachmentsCount doesn’t count files marked for removal. Discard changes brought the PNG back: 3 attachments, count 3.

Finally, I removed the PNG again and saved. The SharePoint item form for Laptop replacement #1000 listed just the two remaining files:

SharePoint item form for Laptop replacement #1000 with the PDF and Word attachments saved from Power Apps

The PNG was gone from SharePoint too, so a saved removal really deletes the attachment.

Make It Production-Ready

  • Guard unsaved work. Microsoft recommends keeping the selected record unchanged while edits are unsaved. Disable the gallery, or ask the user to save or discard first.
  • Keep checks on the server too. AcceptedFileTypes guides the picker, but it doesn’t replace data-source limits or your file-security policies.
  • Use IsUploading. It’s true while files are still loading into the control, so disable the Save button until it’s false. It doesn’t confirm a save.
  • Inside a form, use SubmitForm. The control also works in the Power Apps modern form control, and the form saves the attachments with the record.

Troubleshooting

  • No Attachments control on the Insert menu. Modern controls and themes is off. Turn it on in Settings, Updates, New.
  • Files disappear after you switch requests. They were never saved. Select Save attachments before picking another request.
  • A .txt file isn’t offered. That’s AcceptedFileTypes working: the Windows file picker didn’t list Setup-Notes.txt in my test.
  • Yellow delegation warning on the gallery. The Filter isn’t delegable on SharePoint. Use the whole list or a delegable filter.

Two behaviors I didn’t test come from Microsoft’s documentation. A file over the size limit or of a type not on the list is rejected with an error, which fires OnError. Adding more files than the free slots keeps files up to the limit and reports the rest.

Where to Take It Next

A few more attachment posts you might find handy:

Frequently Asked Questions

Can I use the Power Apps attachment control without a form?

Yes, with the modern control. Bind Items to the record’s Attachments and save with Patch, as shown above. The classic control uploads and deletes only inside a form; see Attachments modern control (preview) on Microsoft Learn.

How do I reset the attachment control in Power Apps?

Run Reset(attRequest) from a button. In my test, it brought back a file marked for removal and returned the footer to 3 attachments. It discards only unsaved changes, not files already saved in SharePoint.

What is the attachment control size limit in Power Apps?

MaxAttachmentSize sets the maximum size of each new file, in MB. The modern control I inserted defaulted to 10. Microsoft notes the data source can still enforce its own limit, so the lower of the two wins. MaxAttachments caps the number of files separately.

Can I remove the undo option from the attachment control?

Microsoft Learn doesn’t list a property that hides it in the modern control. The undo arrow only appears on a saved file marked for removal. After you save, the removal is final and the arrow is gone.

Does adding a file save it to SharePoint right away?

No. The modern control only stages the file and marks it Unsaved. Nothing reaches the list item until Patch or SubmitForm runs, which is why the Save attachments button matters.