Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Optimizing flow : duration and deleting SharePoint List items

Posted on 22 Nov 2024 16:09:25 by 62
Hello everyone,
 
What are my problems :
Optimizing my flow so it does not take 3 days to complete.
Deleting all items from a SharePoint list at once (without having to do a "Get all items" > For each item > delete)

What is my flow about :
Once a month, I have to retrieve all the Planner tasks of 100+ groups into a SharePoint list to feed a Power BI report.
 
My flow big steps :
  • Recurrence trigger
  • Initializing 10 variables
  • HTTP request to Office 365 Groups to get all groups which names begins by "ProjectXX-".
  • For each group > on 150 groups
    • get the corresponding line in a Excel file (that gets me lots of information)
    • get all the Planner plans and filter those to get only the planner called "Project XX"
    • Get all details of the Project XX plan
    • Set several variables (groupName, groupID, planName, planID, categories)
    • Get all the tasks of Project XX plan
    • For each task > approx 150 tasks per group
      • Get the SharePoint list Item with title equals the task ID
      • Condition : does it exist in the list ? Yes > Delete. No > Do nothing
      • Get task details
      • Set variables (categories, is it late, get assigned user displayname...)
      • Create the task in the SharePoint list
      • Reset 5 tasks variables
    • Reset 5 groups variables
  • Refresh Power BI data set.
Here are the screenshot of it (it is super long)
 
Unfortunately, that flow is taking 3 days and 5 hours (and still counting) to complete. We are in the 30 days limit, but still. I am wondering if I could make it last less.
 
What I tried :
I searched cutting my groups using pagination and child flows but unfortunately, I have to work on the default environment without any managed solutions. So child flows are out of the picture.
 
For example: I battled a lot but could not find a way to delete all items from a SharePoint list at once. You always have to do a "Get items" > For each item > Delete. Even using rest API I could not do it.
 
What you can help me with :

Do you have any idea how to :
  • Batch delete all the items of a List at once ? Without passing through a for each step ?
  • Optimize my flow's duration (less than 1 day ? is it possile or am i too hopeful ?)
 
Thanks a lot !
 
  • Suggested answer
    David_MA Profile Picture
    David_MA 7,511 on 22 Nov 2024 at 19:37:44
    Optimizing flow : duration and deleting SharePoint List items
    I have not tied this but take a look at this Power Automate Flow to batch delete SharePoint List Items. It shows how to batch delete items from SharePoint list.

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,111

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,795

Leaderboard