This page is under construction and not yet a part of Power Library!
Being able to work with files from a canvas app is an often requested functionality. There are two options available when only standard functionalities are possible:
- SharePoint list item attachments
- SharePoint document libraries
Let me first explain them.
SharePoint list item attachments
A list item attachment is exactly what the name implies: An attachment to a list item. Being able to store files this way required a list item, which will normally be available when creating a business solution. Example list items are a notification and an order.
Files stored as a list item attachment can only be retrieved within the context of a list item. There is no way with one request to retrieve all files attached to all list items.
A specific control is available for retrieving, attaching and removing files from a list item. I call this control an attachment control and has a paperclip as icon.
SharePoint document libraries
A document library is a container in SharePoint specific for storing files. The content page Data containers contains more information about the possible containers in SharePoint.
Using a document has several advantages over using the list item attachment functionality:
- Additional metadata.
- File versioning.
- No maximum number of files.
- An overview of files over multiple items is possible.
- Adding (Creating), updating and deleting a file can be a trigger for a flow.
- SharePoint search and several other SharePoint document functionalities.
That’s why my by default way to go for storing files is a document library.
File access
SharePoint list item attachments
The attachment control is the only way for direct Create, Update and Delete operations.
Read operations can be done with the attachment control or with the property Attachments
of a list item. The later must be used if the files should be displayed in the canvas app (if possible). The first option allows for a download.
SharePoint document libraries
There no direct way for Create, Read, Update and Delete operations. A cloud flow must be used for this. The content page Upload a file from a canvas app (Power Apps) in a SharePoint document library using a cloud flow (Power Automate) contains more information about adding (creating) a file. The same concept applies to updating and deleting a file.
File permissions
The permissions on a document library and list item of course will determine what someone can exactly do (Create, Read, Update, Delete). When someone has no, or not enough, permissions in SharePoint to perform an action with a file, a cloud flow (Power Automate) can be used to solve this. The content page Upload a file from a canvas app (Power Apps) in a SharePoint document library using a cloud flow (Power Automate) contains more information about this.
Files in the app (Media)
Power Apps allows to add files inside the canvas app at design time to make them available to users of the canvas app. This functionality allows only for reading/download will increase the canvas app size and thus its download time.