web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Power Apps to save multiple images to SharePoint Document Library

(2) ShareShare
ReportReport
Posted on by 4
I have built a Canvas Power App to take a photo and send it to a Sharepoint Document Folder. My camera control is called "CameraRoom". The Camera control code in OnSelect is:
If(
    !IsBlank(CameraRoom.Photo),
    Collect(
        colRoomPhotos,
        {
            FileName: "Photo_" & varCurrentDMCRecord.ID & "_" & DataCardValue41_1.Selected.Value & "_" & Text(Now(), "dd/mm/yyyy") & ".jpeg",
            Room: DataCardValue41_1.Selected.Value,
            RecordID: varCurrentDMCRecord.ID,
            TimeStamp: Today(),
            Photo: CameraRoom.Photo,
            ImageFile: JSON(CameraRoom.Photo, JSONFormat.IncludeBinaryData)
        }
    );
Notify("Photo captured",NotificationType.Success, 1000)
)

 
On the Submit and Reset Button_1 I have the following code:  
ForAll(
    ComboBox1_1.SelectedItems,        
    With(
        {
            SORCodeValue: Text(ThisRecord.'New SOR Code'),
            RoomValue: Text(DataCardValue41_1.Selected.Value),
            RoomTempValue: DataCardValue40_1.Text,
            RoomRHValue: DataCardValue42_1.Text,
            existingSOR: LookUp(
                colSelectedSORs,
                Text(SORCode) = Text(Quantity) &&
                Text(Room) = Text(Room)
            )
        },
        If(
            !IsBlank(existingSOR),
            Patch(
                colSelectedSORs,
                existingSOR,
                {
                    Quantity: existingSOR.Quantity + QuantityInput.Value
                }
            ),
            Collect(
                colSelectedSORs,
                {
                    ID: varCurrentDMCRecord.ID,
                    SORCode: SORCodeValue,
                    Description: 'Short Description',
                    Quantity: 1,
                    Room: RoomValue
                }
            )
        )
    )
);
Collect(
    colSelectedRoomTemps,
    {
        ID: varCurrentDMCRecord.ID,
        Room: DataCardValue41_1.Selected.Value,
        RoomTemp: DataCardValue40_1.Text,
        RoomRH: DataCardValue42_1.Text
    }
);
Notify("Update saved successfully!",NotificationType.Success);
ResetForm('Room Location 1_1');
Reset(ComboBox1_1);
NewForm('Room Location 1_1')


And finally on the SubmitButton I have the following code:
Set(
    formattedSORs,
    Concat(
        colSelectedSORs,
        "Room: " & Room & ", SOR Code: " & SORCode & ", Description: " & Description & ", Qty: " & Quantity & Char(10)
    )
);
Set(
    formattedTemp,
    Concat(
        colSelectedRoomTemps,
        "Room: " & Room & ", Room Temp: " & RoomTemp & Char(10)
    )
);
Set(
    formattedRH,
    Concat(
        colSelectedRoomTemps,
        "Room: " & Room & ", Room RH: " & RoomRH & Char(10)
    )
);
Set(
    varBase64,
    JSON(CameraRoom.Photo, JSONFormat.IncludeBinaryData)
);
Set(
    varCleanBase64,
    Mid(varBase64, Find(",", varBase64) + 1)
);
ForAll(
    colRoomPhotos,
        UploadDMCImages.Run(
        FileName,
        Room,
        TimeStamp,
        varCleanBase64
    )
);
Patch(
        'DMC Surveys',
        LookUp('DMC Surveys', ID = varCurrentDMCRecord.ID),
        {
            'SOR Code': formattedSORs,
            'Room Temp': formattedTemp,
            'Room RH': formattedRH
        }
    );
Clear(colSelectedSORs);
Clear(colSelectedRoomTemps);
Set(varCurrentDMCRecord,Blank());
Clear(colRoomPhotos);
ResetForm('Room Location 1_1');
ResetForm(InitialInfo_Form);
NewForm(InitialInfo_Form);
Reset(AddressComboBox);
Reset(HHSRSdropdown);
Navigate(WelcomeScreen,ScreenTransition.None)


I have created a Power Automate template called UploadDMCImages. I have added the following text inputs to Power Apps(V2):
FileName
Room
TimeStamp
ImageFile
I’ve added my Sharepoint site and Folder path to my Sharepoint Create file step. For the FileName I’ve used the dynamic content for both the FileName and FileContent. I’ve also added an SharePoint Update file properties.
 
A record is saving to the DMC Survey Images Document library in Sharepoint but I’m experiencing two issues:
  1. I cannot view the images ‘It looks like we don’t support this file format’. (I’ve already uploaded both a png and jpeg so know the issue isn’t with SharePoint settings.
  2. Only one record is being created despite multiple images being taken of each room and for different rooms
Please can anyone help restore my sanity as this has really got me stuck???
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    Hello,

    Thank you for sharing the details of your implementation.

    You're on the right track with using Power Apps, Power Automate, and SharePoint to capture and store images. However, the two issues you're encountering—unsupported image format and only one record being created—are likely due to how the image data is being handled and passed to Power Automate.

    Issue 1: Unsupported Image Format in SharePoint

    This typically occurs when the image is saved as a base64 string without proper decoding. SharePoint expects binary content for image files.

    Recommended Fix:

    • In Power Automate, ensure that the Create File action uses:
      • File Content: base64ToBinary(triggerBody()['ImageFile'])
        This converts the base64 string into binary format that SharePoint can render correctly.
      • File Name: Use the dynamic FileName from Power Apps.

    Issue 2: Only One Record Being Created

    This may be due to how the varCleanBase64 variable is being reused for all images, rather than processing each image individually.

    Recommended Fix:

    • Move the base64 conversion logic inside the ForAll loop:
     
    ForAll(
        colRoomPhotos,
        With(
            {
                varBase64: JSON(Photo, JSONFormat.IncludeBinaryData),
                varCleanBase64: Mid(varBase64, Find(",", varBase64) + 1)
            },
            UploadDMCImages.Run(
                FileName,
                Room,
                TimeStamp,
                varCleanBase64
            )
        )
    )
     
    • This ensures each image is processed with its own base64 content.

    Additional Tips:

    • Confirm that UploadDMCImages is correctly configured to accept multiple calls.
    • Use logging or notifications in Power Automate to verify each image is received and processed.
    • Test with a simplified flow to isolate the image upload logic before integrating with other data.

    Please verify if this response was helpful.
    Best regards.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans