cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hemasai1999
Helper III
Helper III

Update an existing attachment by removing or editing

Hi,

I have a SharePoint list as "Training Request List"  and  SharePoint Document Library named "Attendance". 

Hemasai1999_0-1645542400415.png

 

 

Hemasai1999_1-1645542400303.png

 

Now, When we press a PowerApps "upload" button, then it will upload a file (like excel file, ms documents, image file, pdf file, etc) to this SharePoint Document library.

 

Hemasai1999_2-1645542400346.png

 

Now my problem is, after uploading a file, if suppose I have uploaded wrong file then it should be able to remove the uploaded file and then add a correct file. So, How to provide the option to remove attached file in case uploaded wrongly and reupload another.

 

Thanks in advance

 
6 REPLIES 6
WarrenBelz
Super User
Super User

HI @Hemasai1999 ,

Your last image is too small to read, but if you are asking how to delete a file from a SharePoint Library - if for example it was displayed in a Gallery and you put a trash icon in the gallery with 

RemoveIf(
   SPLibraryName,
   ID = ThisItem.ID
) 

it would delete the item.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi @WarrenBelz ,
Thanks for you time,

I am facing issue to delete files present in folder inside documents of SharePoint.

Here I have folder as attendance (pic attached below). For which I have added reqid for each file

Hemasai1999_0-1645682809971.png

Hemasai1999_1-1645682878162.png

Hemasai1999_3-1645683184335.png

I have written formula to delete file in folder and add new item, but instead of deleting it is adding another file. Can you suggest correct way to write formula to delete files in folders.

Thanks in Advance

 

 

 

Hi @Hemasai1999 ,

Folders are "invisible" to Power Apps - you simply need the ID (which is a standard built-in sequential unique number). So if your gallery is based on the Library , then 

RemoveIf(
   Documents,
   ID = Gallery4.Selected.ID
)

will remove the file currently selected in the Gallery.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Hi @WarrenBelz ,

I tried this formula but it's not deleting anything inside Documents/Attendance folder. As I have sub folders inside the documents do I need to mention that path in the formula?

 
 

(RemoveIf( Documents, ReqID = Gallery4.Selected.ReqID )

Thanks in Advance

 

Hi @Hemasai1999 ,

No  - Folders are irrelevant to Power Apps (FolderPath is just another metadata field though you can use it if you want to find them that way). You have a leading bracket on your code, but why are you not using the ID

RemoveIf(
   Documents, 
   ID = Gallery4.Selected.ID
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @Hemasai1999 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,392)