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 / PowerApps attachment c...
Power Apps
Unanswered

PowerApps attachment control how to check if any attachments have been made

(1) ShareShare
ReportReport
Posted on by 186

I am in the process of building a PowerApp that stores its data on a SharePoint OnLine list.

One of the fields is meant to be an Attachments Control that may carry one or more files. The record is validated by checking for data in relevant fields; I need to check whether or not the Attachments Control has any items attached to it.

I was unable to find out how to see if the Attachments Control has some property that would at least tell me if there are attachments associated with the control. The Microsoft documentation doesn't seem to describe any such feature, is there something I missed?

Categories:
I have the same question (0)
  • bboardman Profile Picture
    60 on at

    you can check the number of attachments using countrows:

    CountRows(ThisItem.Attachments)

     

  • v-xida-msft Profile Picture
    on at

    Hi @javierz ,

    Could you please share a bit more about your scenario?

    Do you want to check if there are some files attached to the Attachment control in your Edit form?

    If you want to check if there are some files attached to the Attachment control in your Edit form, I agree with @bboardman thought almost.

    Currently, within PowerApps, there is no direct property supported in Attachments control to tell us that if there are attachments associated with it. As an alternative solution, you could consider take a try to count the amount of the files attached within the Attachments control.

    On your side, please take a try with the following formula:7.JPG

    Set the Text proeprty of the Label control to following:

    "Attachments Amount: " & CountRows(DataCardValue13.Attachments) /* <-- DataCardValue13 represents the Attachments control in my Edit form */

    On your side, you should take a try with the following formula:

    CountRows(YourAttachmentsControl.Attachments)

    if the result above formula returns is more than 0, it means that there are attachments attached within the Attachments control in your Edit form.

     

    Best regards,

  • Verified answer
    javierz Profile Picture
    186 on at

    I like this idea of counting the attachments

    but my goal is to prevent requests from being sent, not having at least 1 attachment

     

    I have it with this variable

     

    OnAddFile

    Set(IsAttached, true)

     

    OnRemoveFile

    Set(IsAttached, false)

     

    and with a condition 

  • DaynaBee Profile Picture
    309 on at

    I wanted to disable Submit button if no attachment is attached. used the below on DisplayMode of the button. AttachmentsNF is my attachment card. 

    If( 
    CountRows(AttachmentsNF.Attachments)>0 ,
        DisplayMode.Edit, DisplayMode.Disabled
        )

  • gretchunkim Profile Picture
    134 on at

    Now, this option is readily available by setting Data Required properties to false.
    Located under Advanced properties.  

  • srose Profile Picture
    94 on at

    Under Action and Advanced -- using the OnAddFile and OnRemoveFile fields is the way to go here.

  • MarmosspinneBW Profile Picture
    23 on at

    Your suggestion worked for me.. Thanks.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard