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 / Problem with attachmen...
Power Apps
Unanswered

Problem with attachments box in SharePoint form ?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,
I have a problem with the attachments box in a custom sharepoint form.
My form contains an attachment box, drop down fields and image galleries .
The drop down fields are populated with the list of files in the attachment box. The image gallery displays the picture selected in the drop down fieldsnap1.png

 

The form is splitted in 3 screens: New screen, edit screen, view screen.
In my view screen, when I try to get the attachments in the collection colAttachments in the "OnVisible", the collection doesn't seem to be correctly populated ! 

snap2.png

I have added the following label to the view page to debug:
"Count rows in colAttachments: " & CountRows(colAttachments) & " - Count files in Attachments box: " & CountRows(AttachmentsBox_2.Attachments) & " - Count in On Visible: " & countInOnVisible
And for one record with one file attached

snap3.png

I got following result -
snap4.png

I got 2 rows in colAttachments instead of  1 row (maybe value 2 coming from previous displayed record ?)


I added a button to refresh the colAttachments on select: ClearCollect(colAttachments;AttachmentsBox_2.Attachments) and I got the good number of row in colAttchments when I click on the button

Capture2.GIF

 

Why the On visible code is not returning the correct value ?  bug with the attachment box ?


Thanks for your feedback

Categories:
  • v-yuxima-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

     

    Do you want to count the attachment files in the attachmnet box in your form?

    You can try the next workaround.

    For example:

    DataCardValue5.OnAddFile=ClearCollect(test,DataCardValue5.Attachments)

    DataCardValue5.OnRemoveFil=ClearCollect(test,DataCardValue5.Attachments)

    Label1.Text=CountRows(test)

    countattachments1.gif

     

    Best Regards.

    Yumia

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello Yumia, 

     

    Helas ...  Your work around doesn't seem to be a solution for a view screen

     

    Why the ClearCollect  in the OnVisible section doesn't set the correct value in the collection ? 

     

    Brs,

    Marc

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Dear@v-yuxima-msft 

    In the edit screen, I try to update the value of the drop down field with the list of Files in the attachments box with

    DropDown field

    OnSelect: ClearCollect(colAttachments1;AttachmentsBox_1.Attachments)

    Items : colAttachments1  value: Name

     

    but I have also a strange result:

    Capture DropDown not showing name.GIF

    The drop down display empty lines in the drop down for the files already saved and display correctly an added file

     

    What can be the issue ? 

  • v-yuxima-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

     

    Do you try as next?

    followup.gif

     

    Best Regards.

    Yumia

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes @v-yuxima-msft . I did the same as you for the New screen as it is the screen where I can add/remove files. I don't have issue there.  

     

    For the View screen (when I browse a record of the sharepoint list for example), I can not use it as I don't have interaction with the attachment box. I initialize my collection colAttachments with ClearCollect(colAttachments;AttachmentsBox_2.Attachments) in the OnVisible section.

     

    For the Edit screen, I do a ClearCollect(colAttachments1;AttachmentsBox_1.Attachments) to get the attachments already uploaded from a previous session ... but the name retrieved is blank !

    snap collection content.png 

    Name is OK for the third file when I add it to the two ones already saved.

    Capture DropDown not showing name.GIF

     

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