cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cyberco01
Level 8

Delete SharePoint document library document using Powerapps

I used the April's post to upload documents to Sharepoint Document Library from the Documents tht were attached in Sharepoint List using Powerapps. It worked well. Documents are attached. I used create or modify trigger. I try to remove one attachment and save form and save form. The document is not removed from Sharepoint Document library. Kindly help as to how i can achieve this feature.
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Delete SharePoint document library document using Powerapps

Hi @cyberco01 ,

Are you able to remove corresponding document from your SP Library when the document removed from a SP List record?

 

If you are able to remove corresponding document from your SP Library when the document removed from a SP List record, I think the solution I proivded above has already solved your problem.

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

In addition, do you want to add attachments to an existing SP List item, and the attached file could also be added into your SP library?

If you want to  add attachments to an existing SP List item, and the attached file could also be added into your SP library, please consider modify your flow's configuration as below:1.JPG

 

2.JPGPlease take a try with above solution, check if the issue is solved on your side.

Note: Within above modified flow configuration, you need to remove all related files within your SP Library based on the ListItemID column value firstly, and then re-add files into your SP Library based on the attachments files within your SP List Item.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Community Support Team
Community Support Team

Re: Delete SharePoint document library document using Powerapps

Hi @cyberco01 ,

Could you please share a bit more about your scenario?

How do you upload documents to your SP Library from the documents attached in your SP List? Using Microsoft Flow?

 

If you use Microsoft Flow to upload documents to your SP Library from the documents attached in your SP List, and want to remove corresponding document from your SP Library when the document removed from a SP List record, I afraid that there is no way to achieve your needs in Microsoft Flow currently.

 

The "When an attachment is removed from a SP List record" trigger is not suppoeted within SP Connector in Microsoft Flow, so there is no way to detect if a attachment is removed from a specific SP List record.

 

As an alternative solution, you could consider add a ListItemID column (Number column) in your SP Library to store the Item ID value of each record in your SP List, which could be used to identify which SP List Item the uploaded file belongs to:9.JPG

I have made a test on my side, please consider take a try with the following flow's configuration:10.JPG

 

11.JPG

 

12.JPG

 

13.JPG

Within the "Condition" action, left Input field set to following formula:

formatDateTime(triggerBody()?['Created'],'yyyy-MM-ddTHH:mm')

right input field set to following:

formatDateTime(triggerBody()?['Modified'],'yyyy-MM-ddTHH:mm')

middle condition box set to "is equal to".

 

Within the "Condition 2" action, middle condition box set to "does not contain", left input filed set to AttachmentsFileName variable initialized before. Right input box set to following:

item()?['{FilenameWithExtension}']

Within the "Delete file" action, File Identifier field set to following formula:

item()?['{Identifier}']

I have made a test on my side, and the flow works successfully. Please take a try with above solution, check if the issue is solved.

Note: I also provided my Sample Flow for you, please refer to it.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cyberco01
Level 8

Re: Delete SharePoint document library document using Powerapps

Thanks a lot for the quick reply. I will try this out today and share you the outcome.

cyberco01
Level 8

Re: Delete SharePoint document library document using Powerapps

I tried the solution as suggested by you, but the attachments are not getting attached using Powerapps in SP List. Also, when I check the details flow that is run, the list says - no attachments

I have attached the video of how I am trying to attach.

cyberco01
Level 8

Re: Delete SharePoint document library document using Powerapps

@v-xida-msft There was some refresh issue with my form. Now, my attachments are getting attached in the list. I can in the details of flow - Attachments = yes. But, the respective attachments are not seen in my document library. Also, while checking the flow detail - my flow expression result is going to the 'NO' condition.

Kindly help. Please do let me know if I need to provide you more information.

cyberco01
Level 8

Re: Delete SharePoint document library document using Powerapps

@v-xida-msft The flow is working as follows (Thanks a lot for the effort)-

 

- I create a new item - attach - save - attachments are now saved in list and document library

- i remove an attachment from the same item - attachment is removed from the list and document library

 

- i try to attach another document in same item - attachment is present in list but not in the document library.

- Any attachment made to an existing list item (initially saved without attachment), the attachment does not get saved to document library

Kindly help me with this. Thanks in advance.

Community Support Team
Community Support Team

Re: Delete SharePoint document library document using Powerapps

Hi @cyberco01 ,

Are you able to remove corresponding document from your SP Library when the document removed from a SP List record?

 

If you are able to remove corresponding document from your SP Library when the document removed from a SP List record, I think the solution I proivded above has already solved your problem.

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

In addition, do you want to add attachments to an existing SP List item, and the attached file could also be added into your SP library?

If you want to  add attachments to an existing SP List item, and the attached file could also be added into your SP library, please consider modify your flow's configuration as below:1.JPG

 

2.JPGPlease take a try with above solution, check if the issue is solved on your side.

Note: Within above modified flow configuration, you need to remove all related files within your SP Library based on the ListItemID column value firstly, and then re-add files into your SP Library based on the attachments files within your SP List Item.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 79 members 3,659 guests
Please welcome our newest community members: