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 Automate - Building Flows
Unanswered

Delete all list items where list name begins with certain prefix

(0) ShareShare
ReportReport
Posted on by 514
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?
I have the same question (0)
  • sannavajjala87 Profile Picture
    47 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
    514 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

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 535 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 348 Moderator

#3
developerAJ Profile Picture

developerAJ 262

Last 30 days Overall leaderboard