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 list created using Microsoft Lists, or a Microsoft Dataverse table.

Description

An Attachments control lets you open, add, and delete files from a list or a Dataverse table.

Limitations

The attachment control has these limitations:

  1. The attachment control only supports lists and Dataverse tables as the data sources. Expressions that transform these data sources into Tables, for example, with the ForAll function, are not supported.

  2. 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.

  3. Attachments control on a web browser lets you select multiple files, and allows use of drag and drop functionality. However, when using attachments control on Power Apps Mobile, you can only add files one at a time.

Key properties

Items – The Attachment column of the list or Dataverse table. Collections and Tables are not supported.

MaxAttachments – The maximum number of files the control will accept.

MaxAttachmentSize – The maximum allowed file size in MB of each new attachment. 1 MB here is 1,000,000 bytes (106 B) or 1,000 KB.

OnAddFile – Actions to perform when the user adds a new file attachment.

OnRemoveFile – Actions to perform when the user deletes an existing attachment.

OnUndoRemoveFile – Actions to perform 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.

Color – The color of a control's text.

DisabledBorderColor – The color of a control's border if the control's DisplayMode property is set to Disabled.

DisabledColor – The color of text in a control if its DisplayMode property is set to Disabled.

DisabledFill – The background color of a control if its DisplayMode property is set to Disabled.

DisplayMode – Whether the control allows adding and deleting files (Edit), only displays data (View), or is disabled (Disabled).

[DropTargetBackgroundColor] – The color of the control's drop target background.

[DropTargetBorderColor] – The color of the control's drop target border.

[DropTargetBorderStyle] – Whether the control's drop target border is Solid, Dashed, Dotted, or None.

[DropTargetBorderThickness] – The thickness of the control's drop target border.

[DropTargetTextColor] – The color of the control's drop target text.

Fill – The background color of a control.

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.

Font – The name of the family of fonts in which text appears.

FontWeight – The weight of the text in a control: Bold, Semibold, Normal, or Lighter.

HoverBorderColor – The color of a control's border when the user keeps the mouse pointer on that control.

HoverColor – The color of the text in a control when the user keeps the mouse pointer on it.

HoverFill – The background color of a control when the user keeps the mouse pointer on it.

Italic – Whether the text in a control is italic.

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.

Padding – The distance between the text on an import or export button and the edges of that button.

PressedBorderColor – The color of a control's border when the user selects that control.

PressedColor – The color of text in a control when the user selects that control.

PressedFill – The background color of a control when the user selects that control.

Reset – Reverts all changes to the attachments control returning to the previously saved state.

Size – The font size of the text that appears on a control.

Strikethrough – Whether a line appears through the text that appears on a control.

TabIndex – Keyboard navigation order in relation to other controls.

Tooltip – Explanatory text that appears when the user hovers over a control.

Underline – Whether a line appears under the text that appears on a control.

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

  1. Add a form to your app, and set a list as its data source.

  2. Select the Display Form control in the tree view on the left-hand side. You can also use Edit Form instead.

  3. Select Data Source in the Properties tab in the options panel on the right and then select the list you connected to.

  4. Select Edit fields in Fields section and select Add field.

  5. Select the Attachments field and select Add.

    The Attachments field associated with the 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 requirement is in addition to the standard color contrast requirements.

Screen reader support

The following properties must be present:

Keyboard support