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 / Removing Attachment fr...
Power Apps
Unanswered

Removing Attachment from SharePoint List but it still shows in the datacard

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I have trawled through a few threads on the community about this, some marked as solved even though I don't believe they are.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Powerapps-Cannot-Clear-Attachments/td-p/155771

https://powerusers.microsoft.com/t5/Building-Power-Apps/Cannot-Clear-Attachments-in-PowerApps/td-p/185762

Are two examples.

 

I have the below screen. There is a gallery (gallery3) at the top which houses some information about an item from a SharePoint List. This is for information purposes only. The default & items property is simply: gallery2.selected (this is on a previous screen. Once selected, user is navigated to the screen I have attached).

 

I want to add and remove the attachment to/from this item. I know I need a form to do that, because attachments are very difficult to use outside forms. So I have and editform called Form2 (Item property: Gallery2.Selected) with Attachments_DataCard1 inside it (default property: ThisItem.Attachments). And inside that is DataCardValue99 (Items property: Parent.Default).

 

I have tried every combination of item properties and default properties and nothing I do seems to work. Everytime I click the attach/delete letter button, the attachment that has been added or removed does get added or removed to/from my sharepoint list, but then it never disappears or stays visible in my attachment control. I have tried resetting the form, I have tried resetting the attachment control, nothing works. It is like the attachment control is not updating when a change has been made to the form/SharePoint list.

 

If I navigate away from this screen and then click on the gallery2 item again the correct information is displayed in the attachment control.

 

freddiejoseph1_0-1621267093918.png

 

 

Any help would be much appreciated. It seems lots of people are having this issue and I cannot find a resolution anywhere.

 

Thanks,

 

Freddie

Categories:
I have the same question (0)
  • R3dKap Profile Picture
    1,594 on at

    Hi @Anonymous,

    Have you tried refreshing the datasource using the Refresh() function right after adding or removing the attachment?

    If the problem still persists, you might wanna post a ticket to Microsoft...

  • Community Power Platform Member Profile Picture
    on at

    Hi @R3dKap 

     

    I have tried refreshing the data source, yep. It still doesn't work.

     

    Thanks, Freddie

  • R3dKap Profile Picture
    1,594 on at

    I'll make a try tomorrow and tell you if I can reproduce this behavior...

  • Community Power Platform Member Profile Picture
    on at

    That would be great. Thank you very much. Let me know if you need any more information 🙂 

  • R3dKap Profile Picture
    1,594 on at

    Ok, I've made a test on my side and everything works fine. But it made me realize that maybe you didn't reset your form after submitting it. If you don't, your attachement will visually not change even though the datasource has been updated.

    Meaning: in your form's OnSuccess event, you must add a call to the ResetForm() function. Is that the case?

    About my test, here is what I did:

    • added a Form1 edit form on my screen and connected it to a Bills SharePoint list
    • added a button labeled SUBMIT and placed the following code in its OnSelect property: SubmitForm(Form1)
    • added a Gallery1 gallery and connected it to the Bills list
    • added a label in the gallery to show the Title field of the list
    • added the following code in Gallery1.OnSelect: Set(gloItemID, ThisItem.ID); EditForm(Form1)
    • set Form1.Item to the following code: LookUp(Bills, ID = gloItemID.ID)
    • added another button labeled NEW and put the following code in its OnSelect property: NewForm(Form1)

    Now when I test it, here is how it behaves:

    • click on NEW button, enter some data and add an attachement -> the attachement is visible
    • click on SUBMIT -> the item is created in the list (with its attachement) -> the form is reset and I don't see any data in the form anymore
    • click on an item in the gallery -> the item is shown in the form and I can see the attachment
    • remove the attachement and click on SUBMIT -> the item is updated (the attachement is removed) and the form is reset -> I don't see any data in the form anymore

    Do you have something similar on your side? If so, it should behave the same. Is that the case? Otherwise try to give me more details so I can help you...

  • Community Power Platform Member Profile Picture
    on at

    Hi,

     

    Thanks for taking the time to make a test and reply back. The problem here is that my form is resetting, even though I don't want it to. The form correctly adds and removes an attachment from the sharepoint list item and also the gallery item above the form I have here.

     

    The problem is that:

     

    When I attach a file to the attachment control in the editform and click the attach/delete letter button, the attachment which has just been added to the item no longer shows in the attachment control in the form. I want the newly attached file to continue showing in the attachment control, but it doesn't. I have just attached a file to this item, but you can see there is no attachment visible in the attachment control. Why?

    freddiejoseph1_1-1621431297464.png

     

     

    If I go back to my home screen and reselect the item which I just added the attachment to, then reopen the attachment screen you will see the attachment is visible in the attachment control. The only thing I have done here is navigate away from the screen and back to the screen.

     

    freddiejoseph1_2-1621431409078.png

     

     

    When I attach a file and submit the form, I want the attachment to stay visible in the attachment control.

     

    The exact same thing happens when I remove/delete an attachment. I delete the attachment, click the attach/delete button which submits the form. The attachment gets deleted from the item in sharepoint (which is correct behaviour) but why does it still show here?

     

    freddiejoseph1_3-1621431544234.png

     

     

    If I navigate away from the screen and back again, the attachment now doesn't show. I want to avoid keep having to navigate away from the screen and back to the screen. It is very confusing for the end user. If I navigate away from the screen and back to the screen once I delete and attachment I see the below....which is correct:

     

    freddiejoseph1_4-1621431625838.png

     

    Thanks,

     

    Freddie

     

  • R3dKap Profile Picture
    1,594 on at

    Ok, I see. Can you tell me how you have designed your attachment screen?

    Is your attachement control inside a form or have you extracted it from a form and placed it directly as a control on the screen?

    What's the code in your Attach/Detach Letter button?

  • Community Power Platform Member Profile Picture
    on at

    Sure. The top part of the screen is a Gallery with just 1 item in it. The item showing is just whichever record they selected from a gallery on the previous screen:

    freddiejoseph1_2-1621438104810.png

     

    The attachment control is still part of an edit form (Form2): 

    freddiejoseph1_1-1621438077150.png

     

    I have tried removing it from a form too, that didn't seem to work either.

     

    The onselect of my attach/delete letter button is: SubmitForm(Form2)

     

    Thanks,

     

    Freddie

  • R3dKap Profile Picture
    1,594 on at

    Ok. What's in your Form2.Items and Form2.DefaultMode properties?

    On your initial screen where you have the gallery, do you use the NewForm() or EditForm() functions?

    Also, what's in your Form2.OnSuccess?

    Got to go... Will read you in a couple of hours...

  • Community Power Platform Member Profile Picture
    on at

    Form2.Item = Gallery2.Selected but I have also tried this with Gallery3.selected which is the gallery on the same screen as the form. Form2.DefaultMode = FormMode.Edit. Form2.OnSuccess = ResetForm(Form2). I have also tried removing the ResetForm from onsuccess and it doesn't change anything.

     

    No I don't use those functions on my initial screen. The onselect of my gallery on the home screen is: Select(Parent); ClearCollect(colThisItem, Gallery2.Selected); Navigate(LetterScreen)

     

    No problem at all. Thanks for all the help, I really appreciate it 😄

     

    Freddie

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard