0

Hi I am trying to build a Dashboard that show summary of what happens in a Planner Plan, Calendar events and SharePoint files etc. I want to show users' task in different tables. I have managed to authorize and get the user list and get the all tasks from a plan by following the documentation. But the tasks I get returns something like this. I can see the task is assigned to "9d2e533d-6e8e-xxx-8959-846xxxbe192ab" but how do I get/print this? I can get the task title by using getTitle() method. But how do I getthe assignee? Or is there a better way to get tasks based on users?

{
        "@odata.etag": "W/\"JzEtVGFzayxxBAxAQxxxEBAWCc=\"",
        "planId": "UeRhlCyHxxxxxk3CpgABpFg",
        "bucketId": "GWqGxxxxak-YzYxxx0-bm-5xxxxzZ9",
        "title": "Arge 2",
        "orderHint": "85xxx467xxxx41871P|",
        "assigneePriority": "",
        "percentComplete": 50,
        "startDateTime": null,
        "createdDateTime": "2020-06-14T12:54:41.8747394Z",
        "dueDateTime": null,
        "hasDescription": false,
        "previewType": "automatic",
        "completedDateTime": null,
        "completedBy": null,
        "referenceCount": 0,
        "checklistItemCount": 0,
        "activeChecklistItemCount": 0,
        "conversationThreadId": null,
        "id": "8BxxxtlHQxxxGPR0xxxgAMfWV",
        "createdBy": {
            "user": {
                "displayName": null,
                "id": "75c90cdf-a9fc-4f55-860a-87076b9a31ef"
            }
        },
        "appliedCategories": {},
        "assignments": {
            "9d2e533d-6e8e-xxx-8959-846xxxbe192ab": {
                "@odata.type": "#microsoft.graph.plannerAssignment",
                "assignedDateTime": "2020-06-14T13:02:07.0513638Z",
                "orderHint": "858609xxxxx8441xxx388P#",
                "assignedBy": {
                    "user": {
                        "displayName": null,
                        "id": "75cx0cdf-a9fc-4xxx-860a-87xxxx9a31ef"
                    }
                }
            }
        }
    },
Shiva Keshav Varma
  • 3,398
  • 2
  • 9
  • 13
Deccoyi
  • 51
  • 3

1 Answers1

2

That is the user id of the assignee, you can get information about the user through Get User request. More efficiently, you can get the group members, and match the id of the user to Group membership which includes basic user info. It is possible to have assignees that are not members of the group, so you should use membership when available and fallback to user info otherwise to get the complete data efficiently.

Tarkan Sevilmis
  • 1,443
  • 7
  • 9
  • Thank you. But my quesiton: under assignments i can see the assignees but it is not a value it is a property(might be wrong term). It is on the left side of the equation (if this makes sense). – Deccoyi Jun 17 '20 at 10:28
  • Yes, that is by design. When this API was formed, there wasn't any support in OData to model a keyed collection where each entry (key = assignee, value = assignment data) can be independently modified along with the properties of its container. An example scenario is, changing the task title along with adding an assignee in a single request. So we chose the only available option, designing these as open types where the keys become dynamic properties. In this case the assignee id becomes the key, therefore it is the name of the dynamic property. Does this make sense? – Tarkan Sevilmis Jun 18 '20 at 16:32