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 / Get last removed file ...
Power Apps
Answered

Get last removed file name from attachment control

(0) ShareShare
ReportReport
Posted on by 51

How can I get the name of the file that is removed from the attachment control? I would be requiring it for some validation.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @sharepointguy can you explain a bit further what you're trying to do. I'm going to bump this as well to see if the community can assist 

     

    @Anonymous 

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I was able to get this to work using a collection which gets loaded with the attachments on a gallery item select, then if an attachment is removed from the attachments control, using the OnRemoveFile event, I compare the collection I filled previously to whats left in the attachments control and then store the name of the file missing / removed in another collection.

     

    The name of my collection to compare is colAttachments


    // gallery OnSelect event
    If(
        ThisItem.'Has attachments' = true,
        ClearCollect(
            colAttachments,
            ThisItem.Attachments
        );   
        ,
        ClearCollect(
            colAttachments,
            Blank()
        )
    );

    // Attachments (DataCardValue19) OnRemoveFile event
    // stores our removed document
    ClearCollect(
        colRemovedAttachments,
        Blank()
    );
    // loop our originally set colAttachments
    ForAll(
        colAttachments,
        If(
            !(colAttachments[@Name] in DataCardValue19.Attachments.Name),
            Collect(
                colRemovedAttachments,
                colAttachments[@Name]
            );
        );   
    );
    // reset collection for other removals
    ClearCollect (
        colAttachments,
        DataCardValue19.Attachments
    );

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 839

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 412

Last 30 days Overall leaderboard