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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prohibit user from add...
Power Apps
Answered

Prohibit user from adding duplicate attachments in Collection

(1) ShareShare
ReportReport
Posted on by 9

Good day everyone.

 

I am struggling.

I have 2 ways for users to add attachments to an email.

 

Option 1:

I have an attachment control where users can add attachments, which are then saved in a collection and later send as email attachments.

Right now it is possible to add the same file multiple times.

Neiker_0-1720431474542.png

I want to prohibit this.

 

The collection is updated everytime a new file gets added, this is what I tried:


Batchmail_attachment (Attachment Viewer)

OnAddFile:

If(CountRows(Filter(colAttachments,DisplayName = ThisRecord.DisplayName))>1,
Notify("No Duplicates allowed"),
Collect(colAttachments,Self.Attachments)
)
Items:
colAttachments
 
This does not work however, you can still add the same file multiple times.
 
Option 2:
Users can add previously saved attachments via checkboxes. These checkboxes also add the attachment to the same collection.
CheckboxCanvas1
OnCheck:
If(CountRows(Filter(colAttachments,DisplayName = ThisRecord.DisplayName))>1,
Notify("No Duplicates allowed"),
Collect(colAttachments,ThisItem.Attachments)
));
 
This also does not work, you can still add the same file multiple times and for some reason can only add a maximum of 2 files, even though the maximum number of attachments is 10.
msedge_ZDDi20SolW.png

Any help is welcome

Thank you

Nick

Categories:
  • Verified answer
    Neiker Profile Picture
    9 on at

    So I gave up on the attachment control, instead I used a gallery, now the only option to add files is via the checkboxes adding the previously entered attachments.

     

    I also used the old checkboxes instead of the new ones because the new one's are very buggy.

    OnCheck

    ForAll(
        ThisItem.Attachments,
            Collect(colAttachments, ThisRecord);
    )
     
    In my Gallery:
    Items:
    colAttachments
     
    Neiker_0-1720697484266.png

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard