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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete all list items ...
Power Automate
Unanswered

Delete all list items where list name begins with certain prefix

(0) ShareShare
ReportReport
Posted on by 531
I have a sharepoint site collection where i have 21 lists, where each list is prefixed with SST_List1, SST_List2, SST_List3,.... and so on.
 
I need to write a power automate to delete sharepoint list items that are created prior to 01 Jan 2025 in all 21 lists automatically. Any idea how to achieve this dynamically?
 
I don't want to write 21 Get items action and delete items action. I want to achieve this in 1 or 2 action. Any idea how to achieve this dynamically?
Categories:
I have the same question (0)
  • Verified answer
    sannavajjala87 Profile Picture
    166 on at
    Delete all list items where list name begins with certain prefix
    Hi,
     
    You won’t be able to delete across 21 lists with a single Get items action because the SharePoint connector is list-specific, but you can absolutely do this dynamically with just a couple of actions in loops.
     

    If you don’t want to maintain the list names at all and all your lists are consistently named (SST_List…), you can:

    Get all matching lists

    • Send an HTTP request to SharePoint:
    • Method: GET
    • Uri:  _api/web/lists?$select=Title,Id&$filter=startswith(Title,'SST_List')

     

    Parse the response

    Use Parse JSON on body('Send_an_HTTP_request_to_SharePoint')?['d']['results'].

    Apply to each list

    Loop over results, and inside:

    Another HTTP GET to /_api/web/lists(guid'<ListId>')/items?$filter=Created lt datetime'2025-01-01T00:00:00Z'

    Loop over those items and call HTTP DELETE on each:

    _api/web/lists(guid'<ListId>')/items(<ItemId>)

    with headers:

    IF-MATCH: *

    X-HTTP-Method: DELETE (or plain DELETE depending on approach)

    You can also batch deletes, but that’s an extra step.

  • Iantaylor2050 Profile Picture
    531 on at
    Delete all list items where list name begins with certain prefix
     
    I am able to implement the power automate as you mentioned. Upto below steps i am able to retrieve all the necessary lists and power automate ran successfully. 
     
    However i am stuck at the last step where actual delete operation is being performed. How do i get the list id and items id for that step?
     
     
      
     
     
    DELETE STEP
  • Suggested answer
    S-Venkadesh Profile Picture
    888 Moderator on at
    Delete all list items where list name begins with certain prefix

    In your case, ‘Send an HTTP request to SharePoint 2’ returns an array of List items to delete

    You can loop through that array (each entry contains the Item ID) and delete each item using the built-in Delete item action.

    I hope this information helps! If it does, please consider giving a 👍.
    Best regards,
    S-Venkadesh
     

     


     

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard