Skip to main content

Notifications

Community site session details

Community site session details

Session Id : LFMbNeJ7vbUB4BWrBtTp+V
Power Automate - Building Flows
Unanswered

Compare Document Library Files vs SharePoint List Item Attachments

Like (0) ShareShare
ReportReport
Posted on 30 Aug 2021 19:29:13 by 8

Hey Everyone,

 

I currently have a Document Library and a SharePoint List.

 

When a new SharePoint List Item is created I have a flow setup to create new folder and copy any attachments into that folder.

 

The issue now is if someone deletes one of the attachments from the list, the photo still remains in the Document Library folder (as expected).

 

I am trying to create a flow that when a new SharePoint list item is added it will do the following:

  • Get list of all the SharePoint list item attachments
  • Get list of all Document Library files
  • Compare all SharePoint list item attachments VS document library
    • If match do nothing
    • If NO match delete the file from Document Library

Struggling to get his flow created, any assistance would be greatly appreciated.

   Thanks

 

  • AC205 Profile Picture
    8 on 31 Aug 2021 at 20:05:23
    Re: Compare Document Library Files vs SharePoint List Item Attachments

    AC205_0-1630440266848.png

    It creates the files and folder(if it doesnt already exist) all in one step like this. When comparing the list item attachments I want to compares it against the same document library path /BusStops/Title

  • ScottShearer Profile Picture
    25,218 Most Valuable Professional on 31 Aug 2021 at 19:30:14
    Re: Compare Document Library Files vs SharePoint List Item Attachments

    @AC205 

    When creating files in the library, they must be created in a folder - correct?  The folder name will be the title of the list item?

    Can the same file name appear twice in different folders?  If so, delete one or all?

     

     

  • AC205 Profile Picture
    8 on 31 Aug 2021 at 19:25:16
    Re: Compare Document Library Files vs SharePoint List Item Attachments

    I guess what I am trying to accomplish is:

     

    Compare all SharePoint list item attachments VS document library

     

    • If file exists in document library but NOT in the list item attachments = Delete the file from document library
    • If file does NOT exist in document library but exists in the list item attachments = create file in document library
  • AC205 Profile Picture
    8 on 31 Aug 2021 at 11:25:34
    Re: Compare Document Library Files vs SharePoint List Item Attachments

    AC205_0-1630409105363.png

     

  • ScottShearer Profile Picture
    25,218 Most Valuable Professional on 30 Aug 2021 at 19:55:45
    Re: Compare Document Library Files vs SharePoint List Item Attachments

    @AC205 

    Can you tell me how you name the folder?  The Flow will need to know the folder name in order to find the files.

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started