Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Adding bulk files to Dataverse

(1) ShareShare
ReportReport
Posted on by 2
Hi Everyone,
Maybe I have fried my brain on caffeine. Here is my problem:
 
I want to open a dialog box to search files on a local drive.
Using the dialog box I want to select a single file or multiple files of different types (doc, pdf, xls, jpeg, etc)
I want to save the files in a dataverse table called "Jasonfiles"
In Jasonfiles there is a field called 'Document1' field type "File"
 
Me being the lazy programmer I am, I thought I would save a pile of time using the "Add Photo" control since it appeared to have everything I needed built in.
 
BUT...
If I add a "Add Photo" control called "AddMediaButton1" and use this control to select a file it appears all the file data is contained in the property "Media"
AND...
AddMediaButton1.Media is of type 'Text'
 
So does anyone know a easy way to convert AddMediaButton1.Media into a 'File" type to save into Document1?
 
Or for that matter does anyone have an easier solution to what I am trying to do?
 
Thanks
Jason
Categories:
  • Suggested answer
    vipuljain03 Profile Picture
    vipuljain03 188 on at
    Adding bulk files to Dataverse
    Please click Accept as solution if my post helped you solve your issue. ✔️ This will help others find the solution to this problem. It also closes the item.

    If the content was useful in other ways, please consider giving it Thumbs Up. 👍
  • Verified answer
    vipuljain03 Profile Picture
    vipuljain03 188 on at
    Adding bulk files to Dataverse
    The "Add Media" control (in your case, its "AddMediaButton1") is primarily designed for images, and while it stores the media as base64-encoded text in the "Media" property, it can't be used directly to upload files into a Dataverse table. 
     
    You can leverage Power Automate flow to upload files using base64-encoded data from Power Apps.
     
    For File Picker, you can use a third-party PCF control for multi-file upload.
     
    Below is a sample Power Apps code, which you can reuse:
    Set(
       fileContentBase64,
       JSON(AddMediaButton1.Media, JSONFormat.IncludeBinaryData)
    );
    
    Set(
       fileName,
       AddMediaButton1.FileName
    );
    
    Set(
       fileType,
       AddMediaButton1.FileType
    );
    
    // Trigger Power Automate
    Set(
       response,
       PowerAutomateFlow.Run(fileContentBase64, fileName, fileType)
    );

    In Power Automate, you can use Dataverse connector to upload the file content into the "Jasonfiles" table.
     
    ----------------------------------------
     
    If this reply helped you, please mark this reply as suggested answer ✔️ and give it a like to help others in the community find the answer too!
     
    Thanks,
    Vipul

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard