AHeizenberg / AttachmentControlPCF

A new PCF to elevate your file handling capabilities. This PCF includes features like file size restrictions, type restrictions, previews, themes and more!
1 stars 0 forks source link

PowerApps Attachment Control PCF 📁

Author: Ahad Hamirani

Prerequisites

Before using the Attachment Control PCF, ensure the following:

  1. You have downloaded the latest released version of the PCF solution. Download Solution
  2. You have added the Attachment Control PCF Solution to your environment
  3. You have added the PCF control to your Canvas App

Helpful Documentation: How to Add a PCF to A Canvas App

Properties 🚀

Allowed File Types

Default Files

Max Number of Files

Max File Size

Max Total Size

File Container Height

Some common scenarios 📖

How to access list of attached files:

In order to parse all files into a PowerApps collection you can use the code below:

Table(ParseJSON(AttachmentControl.Files))

Then you can simply access the files in the collection using code similar to below:

FileName : ThisItem.Value.name
FileContent : ThisItem.Value.content

How to add defualt files to the attachment control

Purpose: The reason I have added a reset toggle is to provide makers the ability to "reset" this PCF to it's Default State.

Default State: The Default State of this PCF is one where all user uploaded files are cleared and any default provided files are kept or restored.

Uses:
Clear Files: This property can be used to clear all files within the attachment control (given that the default files are empty)
Restore Default Files: This property can restore all default files. This can be handy if makers use the attacment control as part of a form and want to restore changes

🗒️Note: Setting this property to "true" will reset the control and keep it in reset mode, but in order to avoid any bugs please make sure to toggle the property off before using it again.

💡Suggestion: I would reccomend setting this property to the inverse of the visibilty of the control. Meaning when the control is hidden it gets reset and when it is visible the reset property is toggled off.

Conclusion

This is the intial version of this PCF and although I have used it in production and done testing it may contain bugs. If you encounter any issues or bugs feel free to let me know and I will try my best to address them.
Happy Developing!