Unable to Map Planner Task Checklists in Microsoft Teams Planner Using Microsoft Graph API

Copper Contributor

Dear Microsoft Community,

 

I am currently working on a project where I am utilizing the Microsoft Teams Planner API via Microsoft Graph to manage tasks.
I have successfully mapped tasks using Microsoft.Graph.IPlannerTasksCollectionPage which works perfectly for tasks. However, I am facing challenges in mapping checklists associated with Planner tasks.

I have explored the Microsoft Graph API documentation and various resources, but I am unable to find an equivalent interface like IPlannerTasksCollectionPage for checklists. I need to understand how to retrieve and map Planner task checklists in a similar structured manner to tasks.

 

Here are my specific questions:

  1. Is there an equivalent of IPlannerCheckListCollectionPage in Microsoft Graph API for Planner task checklists?

    I am looking for a collection page interface or any other approach to efficiently retrieve and map checklists associated with Planner tasks. This will help in managing and displaying checklists in our application.

  2. What is the recommended method for mapping checklists associated with Planner tasks?

    If there isn't a specific collection page interface for checklists, could you please guide me on the best practices or recommend an alternative method to efficiently retrieve and map Planner task checklists?

I appreciate any assistance or guidance you can provide regarding this issue. Your support will greatly help me in moving forward with my project.

 

Thank you in advance for your time and expertise!

 

2 Replies

Hi ,

thanks for your questions.

Is there an equivalent of IPlannerCheckListCollectionPage in Microsoft Graph API for Planner task checklists?

No, there is not an equivalent of IPlannerCheckListCollectionPage in Microsoft Graph API for Planner task checklists. However, you can use the following steps to efficiently retrieve and map checklists associated with Planner tasks:

  1. Get the plannerTaskDetails object for the task whose checklist you want to retrieve.
  2. Get the checklistItems property of the plannerTaskDetails object. This property is a collection of plannerChecklistItem objects.
  3. Iterate over the plannerChecklistItem objects and map them to your application objects.

    Here is an example of how to retrieve and map Planner task checklists using the Microsoft Graph API:

 

import requests

# Get the plannerTaskDetails object for the task whose checklist you want to retrieve.
task_id = 'YOUR_TASK_ID'
url = f'https://graph.microsoft.com/v1.0/planner/tasks/{task_id}/details'
response = requests.get(url)

# Check the response status code.
if response.status_code != 200:
    raise Exception(f'Failed to retrieve plannerTaskDetails object: {response.status_code}')

# Get the checklistItems property of the plannerTaskDetails object.
planner_task_details = response.json()
checklist_items = planner_task_details['checklistItems']

# Iterate over the plannerChecklistItem objects and map them to your application objects.
application_checklist_items = []
for checklist_item in checklist_items:
    application_checklist_item = {
        'id': checklist_item['id'],
        'title': checklist_item['title'],
        'isChecked': checklist_item['isChecked'],
    }
    application_checklist_items.append(application_checklist_item)

# Do something with the application_checklist_items list.

 


The recommended method for mapping checklists associated with Planner tasks is to use the approach described above. This approach is efficient because it only requires a single request to retrieve the plannerTaskDetails object and the checklistItems property.

Another alternative method to retrieve Planner task checklists is to use the plannerChecklistItem resource. However, this approach is less efficient because it requires a separate request for each checklist item.

You can use these links as a reference:
plannerChecklistItems-Ressourcentyp - Microsoft Graph v1.0 | Microsoft Learn
Use the Planner REST API - Microsoft Graph v1.0 | Microsoft Learn

Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.

Kindest regards,

Leon Pavesic
(LinkedIn)

Hello @LeonPavesic ,

I am currently working on a project where I need to create checklists in Planner tasks using the Graph API SDK in C#. I've encountered an issue while attempting to achieve this goal, and I'm seeking assistance to clarify a few points and resolve the problem.

Problem Description:

I am trying to create checklists in already created tasks using the Graph API SDK in C#. I am trying to use this graph API for 2 cases: 

await graphClient.Planner.Tasks["{plannerTask-id}"].PatchAsync(requestBody, (requestConfiguration) => {   requestConfiguration.Headers.Add("Prefer", "return=representation");   requestConfiguration.Headers.Add("If-Match", "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\""); }); 

 

I have attempted two methods:

1st Way: I tried to update the task details of an already created task with the details property set to NULL.

2nd Way: I attempted to update the name of a checklist within an already created task with checklists added to it.

In both cases, I am receiving the same exception:

 

Microsoft.Graph.ServiceException
HResult=0x80131500
Message=Message:
The request is invalid: Value cannot be null.
Parameter name: qualifiedName

Questions:

  1. Is it the correct approach to create checklists in tasks when the details property is NULL?
  2. Why am I getting the same exception in both cases, whether the details property is NULL or not?
  3. Could you please confirm if there is any way to create checklists using the Graph API in C# with the details property set to NULL? If yes, could you provide implementation details or code examples?

    I appreciate any insights or guidance you can provide to help me resolve this issue. Thank you in advance for your assistance!