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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using Camera Control b...
Power Apps
Answered

Using Camera Control but not possible to save as attachment to SharePoint list

(1) ShareShare
ReportReport
Posted on by 261
Hello 
I have created an power app with a camera control and a library to see the photo and to save it to a SharePoint list as attachement.
It was working before but after a couple of weeks ago it starts not saving the photo as atachment in the list.
The code for the button to make a photo is:
UpdateContext({varPID: GUID()});
Collect(
    colImage2,
    {
        Value: Camera1.Stream,
        DisplayName: Text("Mikel-" &
            Now(),
            "[$-en]hhmmss"
        ) & ".jpg",
        Id: varPID,
        AbsoluteUri: ""
    }
)

So I can see the image in a library include displayname.
The library is using as Items: colImage2
In the EDIT form for the SharePoint list I have two fields: TITLE and ATTACHMENTS
The ATTACHMENT control is using for Items: colImage2
The save button has the following formula: 
Patch(Brazil_Attachment_Picture, frmFoto.Updates);  // The form name of the SharePoint list
Clear(colImage2);
Refresh(Brazil_Attachment_Picture);
ResetForm(frmFoto)
THE PROBLEM
I cannot save the attachment, which was possible before.
I don't know if thats a problem of a Microsoft update of the PowerApps environment.

Thanks in advance for helping out.
Kind regards
Michael
Categories:
I have the same question (0)
  • Verified answer
    Ammar Zaied Profile Picture
    97 on at

    The issue you're facing could be related to changes or updates in the Power Apps environment, but let's first troubleshoot based on your current setup. Here are a few things you can check and update in your app:

    1. Review the Camera Control

    Ensure that the Camera1.Stream is still correctly capturing the image. A good test is to display the image on a label or gallery control to ensure the camera is capturing the stream properly.

    2. Format for Attachments

    In your formula for saving attachments to SharePoint, the image stream needs to be converted to a format SharePoint can recognize, like base64 encoding. However, SharePoint lists expect an actual file or image as an attachment, not just a stream.

    Try modifying the Collect function to include base64 encoding:

    Collect(
        colImage2,
        {
            Value: JSON(Camera1.Photo, JSONFormat.IncludeBinaryData),
            DisplayName: Text("Mikel-" & Now(), "[$-en]hhmmss") & ".jpg",
            Id: varPID,
            AbsoluteUri: ""
        }
    )
    

    3. Form's Attachment Control

    Check that the Attachments control is still correctly bound to the form. Sometimes, it loses its connection to the data source, and you need to re-establish it.

    • Make sure that frmFoto is bound to the correct SharePoint list (in this case, Brazil_Attachment_Picture).
    • In the form, ensure that the Attachments control is set to colImage2 and is allowed to upload images.

    4. Use Patch with Attachments

    Instead of directly using Patch(Brazil_Attachment_Picture, frmFoto.Updates);, try using SubmitForm(frmFoto) to submit the form with the attachment. The Patch function may not handle file attachments in the same way as the SubmitForm function does.

    Here’s an alternative approach for the Save button:

    SubmitForm(frmFoto);
    Clear(colImage2);
    Refresh(Brazil_Attachment_Picture);
    ResetForm(frmFoto);
    

    5. Check for Updates or Known Issues

    If everything worked previously and stopped after a couple of weeks, it's possible that an update might have affected the behavior of file attachments. You could try reverting to an earlier version of your Power App to see if that resolves the issue, or check Microsoft Power Apps updates for any reported issues.

    6. Check File Size Limits

    Sometimes, there could be issues if the file size exceeds certain limits imposed by SharePoint or Power Apps. Ensure that the images captured by the camera control are within a reasonable size.

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard