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:
- 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.
- 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???