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 / Delete SharePoint docu...
Power Apps
Unanswered

Delete SharePoint document library document using Powerapps

(0) ShareShare
ReportReport
Posted on by 480
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.
Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    on at

    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,

  • cyberco01 Profile Picture
    480 on at

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

  • cyberco01 Profile Picture
    480 on at

    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 Profile Picture
    480 on at

    @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 Profile Picture
    480 on at

    @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.

  • Verified answer
    v-xida-msft Profile Picture
    on at

    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,

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard