cancel
Showing results for 
Search instead for 
Did you mean: 

Remove/Delete Completed Tasks in Planner

I use Flow to create tasks on a regular basis, but I have no automated way to remove completed tasks.  I would like to be able to remove completed tasks from a Planner bucket using a Flow.

Status: New
Comments
Amanzi
New Member

Would love to know the same!  I don't want to see my completed tasks it is taking up space I focus on what is active the same way that you can change views on Outlook tasks.  I created a flow that:  When a task is assigned to me in 'Planner' create an 'Outlook Task' which works BUT when I complete the task in Outlook it does not complete in Planner - any way around this?

Mike_B
Regular Visitor

An action which can be added to a scheduled task which has a few selectable options would be brilliant.

 

  • Team
  • Planner
  • Bucket
  • Age in days since marked completed
David_Nguyen
Microsoft

Here are steps to make a Scheduled flow to DELETE completed tasks in a Plan

 

List your Tasks in plan. Then, Apply to each task, get task, then Delete it.

image.png

Use Invoke an HTTP request with resource fields are

https://graph.microsoft.com.

URL: https://graph.microsoft.com/v1.0/planner/tasks/@{items('Apply_to_each')?['id']}

 

Use Parse Json with schema is:

 

{
    "type""object",
    "properties": {
        "@@odata.context": {
            "type""string"
        },
        "@@odata.etag": {
            "type""string"
        },
        "planId": {
            "type""string"
        },
        "bucketId": {
            "type""string"
        },
        "title": {
            "type""string"
        },
        "orderHint": {
            "type""string"
        },
        "assigneePriority": {
            "type""string"
        },
        "percentComplete": {
            "type""integer"
        },
        "startDateTime": {},
        "createdDateTime": {
            "type""string"
        },
        "dueDateTime": {},
        "hasDescription": {
            "type""boolean"
        },
        "previewType": {
            "type""string"
        },
        "completedDateTime": {},
        "completedBy": {},
        "referenceCount": {
            "type""integer"
        },
        "checklistItemCount": {
            "type""integer"
        },
        "activeChecklistItemCount": {
            "type""integer"
        },
        "conversationThreadId": {},
        "id": {
            "type""string"
        },
        "createdBy": {
            "type""object",
            "properties": {
                "user": {
                    "type""object",
                    "properties": {
                        "displayName": {},
                        "id": {
                            "type""string"
                        }
                    }
                }
            }
        },
        "appliedCategories": {
            "type""object",
            "properties": {}
        },
        "assignments": {
            "type""object",
            "properties": {}
        }
    }
}
 
Add a new condition control to check if percentComplete is equal to 100
 
image.png
 
Then Delete the task id with the If-Math is from the dynamic content under the Get IF-MATCH action.
image.png
Good Luck!
 
David Nguyen
Hackerman
Regular Visitor

Heads up: The approach documented by @David_Nguyen probably works, but you need a Premium license to use the "Invoke an HTTP request" task.

Mike_B
Regular Visitor

Yes @Hackerman , I was hoping to get support to get the facility included in the functionality as an inbuilt feature more than 'belt and braces' to be honest.  I would have thought that most users would benefit from a simpler method of achieving this easily.

There is quite a bit lacking in the Planner app, it is not even easy to get the name of the person who completed a task to add for logging, really obvious stuff.

 

Mike.

uvaismohammed
New Member

@David_Nguyen I have more than 1000 tasks and it doesn't work for some reason. Can you please help?

cleytonp
Regular Visitor

I can't sign @David_Nguyen  , @David_Nguyen_vn 
could someone please help me.

 

Failed with error: 'AADSTS500011: The resource principal named https://graph.microsoft.com/v1.0/planner/tasks/ was not found in the tenant named a7cdc447-3b29-4b41-b73e-8a2cb54b06c6. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant. '. Please sign in again.

 

 

error.PNG 

cleytonp
Regular Visitor

I found a solution for that. Just take a look, it erases all completed.
how to Remove/Delete Completed Tasks in Planner

Capture.PNG

uvaismohammed
New Member

will this delete about 1000 tasks? I think I tried this but it was not deleting when the tasks are more than 400.

cleytonp
Regular Visitor

@uvaismohammed it's possible.
But he probably had a timeout error.

What you can do is to increase the frequency of times that you back up so as not to let 1000 tasks reach, when less tasks are faster to delete and also to export via excel.