web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Check If a Shar...
Power Automate
Suggested Answer

How to Check If a SharePoint List Item Exists Before Create/Update

(0) ShareShare
ReportReport
Posted on by 18

Hey everyone,
I’m running into an issue with a Power Automate flow and I’m hoping someone with more experience can help :)

  • I have a SharePoint document library folder that contains documents.

  • I also have a SharePoint list where I want to maintain an overview of all documents in that folder (one list item per document).

  •  

I want my flow to keep the SharePoint list in sync with the folder:


  • If a document is new in the folder, create a new list item.

  • If a document is modified in the folder, update the existing list item.
 
I use the trigger “When a file is created or modified” (because I want to cover both new uploads and edits).
When the flow runs, I try to check whether this document already exists in the SharePoint list.
To do that, I compare a unique identifier:
  • I want to use the document’s unique ID (the “UniqueKey” from the built-in column that comes with SharePoint lists), and compare it to a ID from 'Get Item'.
Then:
  • If the ID already exists in the list (meaning it’s a “modified” scenario), the flow should update that list item.
  • If the ID does not exist in the list (meaning it’s a “new file” scenario), the flow should create a new list item
 

     

In my head, this structure makes sense but in it doesn’t work as expected.
The flow either fails during the lookup step, or it doesn’t correctly detect whether the item already exists, so the update/create logic doesn’t behave properly.

 

What am I doing wrong, and how can I improve this flow design to reliably:

  • check whether the document already exists in the list (based on the unique ID), and then

  • update the list item if it exists, otherwise create a new one?

  •  

It would be amazing if someone could help me troubleshoot the approach

Categories:
I have the same question (0)
  • Suggested answer
    Vish WR Profile Picture
    3,748 on at
     

    UniqueKey is not the best value to compare in Power Automate because it can be inconsistent depending on the action/output. Instead, use a stable value like:

    • File Identifier
    • File Path
    • or SharePoint Item ID
    You can try 
    1. Trigger → When a file is created or modified
    2. Use Get items on your tracking list with a Filter Query matching the file identifier/path
    3. Check:
      • If item exists → Update list item
      • If no item found → Create list item

     

    Store the document’s Identifier or Server Relative URL in the SharePoint list as a unique column, then use that for lookup every time.

    Vishnu WR
     
    Please  Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like 


     
  • David_MA Profile Picture
    14,956 Super User 2026 Season 1 on at

    I think there’s a small misunderstanding here. A document library is a SharePoint list, but it’s a different list than your custom SharePoint list. Each list generates its own IDs independently, so a file’s ID in a document library won’t correlate to the ID of a list item.

    's recommendation to store the Identifier or Server Relative URL in the SharePoint is good. You can then use the Get items action with a query filter on this value to see if an item exists in the list with this value already. You'll use a length() expression to check how many items are returned, and if it returns 0, that means an item does not yet exist with the same Identifier.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard