Attachments control in Power Apps
A control that allows users to download files to their device, as well as upload and delete files from a SharePoint list or a Microsoft Dataverse entity.
Limitations
The attachment control has these limitations:
Attachments are supported with SharePoint lists and Dataverse entities.
Upload and delete functionality work only inside a form. The Attachment control appears disabled when in Edit mode and not inside a form. To save file additions and deletions, the app user must save the form. Because of this limitation, the Attachment control isn't available from the Insert tab but appears in the form when the Attachment form field is enabled in a SharePoint or Dataverse form.
You can upload files only if they're 50 MB or smaller.
Description
An Attachments control lets you open, add, and delete files from a SharePoint list or a Dataverse entity.
Key properties
Items – The source describing the files that can be downloaded.
MaxAttachments – The maximum number of files the control will accept.
MaxAttachmentSize – The maximum allowed file size in MB of each new attachment. Currently there is a limit of 50 MB.
OnAddFile – How the app responds when the user adds a new file attachment.
OnRemoveFile – How the app responds when the user deletes an existing attachment.
OnUndoRemoveFile – How the app responds when the user restores a deleted attachment.
Additional properties
AccessibleLabel – Label for screen readers. Should describe the purpose of the attachments.
AddAttachmentText – The label text for the link used to add a new attachment.
BorderColor – The color of a control's border.
BorderStyle – Whether a control's border is Solid, Dashed, Dotted, or None.
BorderThickness – The thickness of a control's border.
DisplayMode – Whether the control allows adding and deleting files (Edit), only displays data (View), or is disabled (Disabled).
FocusedBorderColor – The color of a control's border when the control is focused.
FocusedBorderThickness – The thickness of a control's border when the control is focused.
Height – The distance between a control's top and bottom edges.
MaxAttachmentsText – The text that replaces the "Attach file" link when the control contains the maximum number of files allowed.
NoAttachmentsText – Informational text shown to the user when there are no files attached.
TabIndex – Keyboard navigation order in relation to other controls.
Visible – Whether a control is visible or hidden.
Width – The distance between a control's left and right edges.
X – The distance between the left edge of a control and the left edge of its parent container (or screen, if no parent container).
Y – The distance between the top edge of a control and the top edge of the parent container (or screen, if no parent container).
Example
Add a form to your app, and set a SharePoint list as its data source.
Select the Display Form control in the tree view on the left-hand side. You can also use Edit Form instead.
Select Data Source in the Properties tab in the options panel on the right and then select the SharePoint list you connected to.
Select Edit fields in Fields section and select Add field.
Select the Attachments field and select Add.
The Attachments field associated with the SharePoint list will appear in the form.
Learn how to add and configure a control
Accessibility guidelines
Color contrast
There must be adequate color contrast between:
- ItemColor and ItemFill
- ItemHoverColor and ItemHoverFill
- ItemPressedColor and ItemPressedFill
- AddedItemColor and AddedItemFill
- RemovedItemColor and RemovedItemFill
- ItemErrorColor and ItemErrorFill
- AddAttachmentColor and Fill
- MaxAttachmentsColor and Fill
- NoAttachmentsColor and Fill
This is in addition to the standard color contrast requirements.
Screen reader support
The following properties must be present:
- AccessibleLabel
- AddAttachmentsText
- MaxAttachmentsText
- NoAttachmentsText
Keyboard support
- TabIndex must be zero or greater so that keyboard users can navigate to it.
- Focus indicators must be clearly visible. Use FocusedBorderColor and FocusedBorderThickness to achieve this.
Note
Can you tell us about your documentation language preferences? Take a short survey.
The survey will take about seven minutes. No personal data is collected (privacy statement).