Data Providers
...
MS Graph
Graph tasks
Get To-do lists & tasks
6min
Get a list of To-do tasks for a user in Microsoft Graph using a GET REST function and display the tasks in a list .
Resource links:
Required OAuth scope (least to most privilege):
Tasks.Read Tasks.ReadWrite
Task list
index.jigx
1name: ms-graph-demonstrator
2title: MS Graph Demonstrator
3description: A sample solution that uses the Microsoft Graph API. You can deploy and use this solution without any additional configuration.
4category: business
5widgets:
6 - size: 2x2 # choose size of the widget on the home hub
7 jigId: view-user-jigx
8 - size: "2x2"
9 jigId: calendar-summary
10 - size: "4x2"
11 jigId: next-meeting
12 when: |
13 [email protected]=null? false:true
14 - size: "2x2"
15 jigId: list-email-messages
16 - size: "2x2"
17 jigId: list-task-lists
18 - size: "4x2"
19 jigId: items-trending
20
21onFocus:
22 type: action.action-list
23 options:
24 isSequential: true
25 actions:
26 - type: action.sync-entities
27 options:
28 provider: DATA_PROVIDER_REST
29 entities:
30 - entity: user-profile
31 function: get-user-profile
32 functionParameters:
33 accessToken: microsoft.OAuth
34 - entity: profile-picture
35 function: get-profile-picture
36 functionParameters:
37 accessToken: microsoft.OAuth
38 userId: [email protected]
39 - entity: user-emails
40 function: get-user-emails-addresses
41 functionParameters:
42 accessToken: microsoft.OAuth
43 - entity: items-trending
44 function: get-items-trending
45 functionParameters:
46 accessToken: microsoft.OAuth
47 - entity: next-week-calendar-events
48 function: get-calendar-events-next-week
49 functionParameters:
50 accessToken: microsoft.OAuth
51 startdatetime: =$fromMillis($millis())
52 enddatetime: =$fromMillis($millis()+604800000)
53 - entity: calendars
54 function: get-calendar-list
55 functionParameters:
56 accessToken: microsoft.OAuth
57 - entity: todo-task-lists
58 function: get-task-lists
59 functionParameters:
60 accessToken: microsoft.OAuth
61 - entity: email-messages
62 function: get-email-messages
63 functionParameters:
64 accessToken: microsoft.OAuth
65 $filter: ="receivedDateTime ge " & $fromMillis($millis()-432000000)
66 - type: action.sync-entities
67 options:
68 provider: DATA_PROVIDER_REST
69 entities:
70 - entity: todo-tasks
71 function: get-all-todo-tasks
72 functionParameters:
73 accessToken: microsoft.OAuth
74 taskListIds: |
75 ={
76 "requests": $map(@ctx.datasources.task-lists.id, function($v, $i, $a) {
77 {
78 "id": $string($i + 1),
79 "method": "GET",
80 "url": "me/todo/lists/" & $v & "/tasks?$top100",
81 "dependsOn": $i>0? [$string($i)]
82 }
83 })
84 }
85
86onRefresh:
87 type: action.action-list
88 options:
89 isSequential: true
90 actions:
91 - type: action.sync-entities
92 options:
93 provider: DATA_PROVIDER_REST
94 entities:
95 - entity: todo-task-lists
96 function: get-task-lists
97 functionParameters:
98 accessToken: microsoft.OAuth
99
100 - type: action.sync-entities
101 options:
102 provider: DATA_PROVIDER_REST
103 entities:
104 - entity: todo-tasks
105 function: get-all-todo-tasks
106 functionParameters:
107 accessToken: microsoft.OAuth
108 taskListIds: |
109 ={
110 "requests": $map(@ctx.datasources.task-lists.id, function($v, $i, $a) {
111 {
112 "id": $string($i + 1),
113 "method": "GET",
114 "url": "me/todo/lists/" & $v & "/tasks?$top100",
115 "dependsOn": $i>0? [$string($i)]
116 }
117 })
118 }
119
MS Graph list To-do tasks function in GitHub.
get-all-todo-tasks.jigx
get-task-lists.jigx
1provider: DATA_PROVIDER_REST
2method: GET
3url: https://graph.microsoft.com/v1.0/me/todo/lists
4outputTransform: $
5parameters:
6 accessToken:
7 location: header
8 required: true
9 type: string
10 value: microsoft.OAuth #Use manage.jigx.com to define credentials for your solution
11 $top:
12 type: string
13 location: query
14 required: false
15 value: 100
16records: =$.value
17continuation:
18 when: =$."@odata.nextLink"
19 url: =$."@odata.nextLink"
20 parameters:
21 accessToken:
22 location: header
23 required: true
24 type: string
25 value: microsoft.OAuth
26errorTransform: |
27 {
28 "error": "No lists"
29 }
MS Graph list To-do tasks in GitHub.
list-task-lists.jigx
1title: Task Lists
2type: jig.list
3icon: contact
4
5header:
6 type: component.jig-header
7 options:
8 height: small
9 children:
10 type: component.image
11 options:
12 source:
13 uri: https://www.windowslatest.com/wp-content/uploads/2018/12/Office-apps-new-icons.jpg
14
15onRefresh:
16 type: action.action-list
17 options:
18 actions:
19 - type: action.sync-entities
20 options:
21 provider: DATA_PROVIDER_REST
22 entities:
23 - entity: todo-task-lists
24 function: get-task-lists
25 functionParameters:
26 accessToken: microsoft.OAuth
27
28datasources:
29 mydata:
30 type: datasource.sqlite
31 options:
32 provider: DATA_PROVIDER_LOCAL
33 entities:
34 - entity: todo-task-lists
35 - entity: todo-tasks
36 query: SELECT json_extract(tlists.Data, '$.id') as tlId, json_extract(tlists.Data, '$.displayName') as tlDisplayName,
37 json_extract(tlists.Data, '$.isOwner') as isOwner, count(json_extract(tasks.Data, '$.id')) AS task_count
38 FROM [todo-task-lists] tlists
39 LEFT JOIN [todo-tasks] tasks ON json_extract(tlists.Data, '$.id') = json_extract(tasks.Data, '$.toDoListId')
40 Group by json_extract(tlists.Data, '$.id'),json_extract(tlists.Data, '$.displayName')
41 order by task_count desc
42
43data: [email protected]
44item:
45 type: component.list-item
46 options:
47 title: [email protected]
48 leftElement:
49 element: icon
50 icon: task-list
51 divider: solid
52 rightElement:
53 element: icon
54 icon: arrow-right
55 subtitle: |
56 [email protected]? "Owner of the list: Yes":"Owner of the list: No"
57 label:
58 title: |
59 [email protected]_count
60
61widgets:
62 "2x2":
63 type: widget.list
64 options:
65 data: [email protected]
66 item:
67 type: component.list-item
68 options:
69 title: [email protected]
70 leftElement:
71 element: icon
72 icon: task-list
73 divider: solid
74 subtitle: |
75 ="Number of Tasks: " & @ctx.current.item.task_count
76
Updated 03 May 2024
Did this page help you?