MS Planner – Tasks – Get Tasks
MS Planner – Tasks – Get Tasks
Get Planner tasks for a user.
Action details
| Property | Value |
|---|---|
| Action label | MS Planner – Tasks – Get Tasks |
| Category | CloudTools |
| Apex class and method | GetMSPlannerTasks.getTasks |
| Input type | GetMSPlannerTasks.GetMSPlannerTasksInput |
| Output type | List<List<MSPlannerTask>> |
| Authorization | Microsoft 365 connector; delegated or application access depends on the endpoint. |
| Microsoft Graph request | GET /me/planner/tasks (delegated) or /users/{userIdOrPrincipalName}/planner/tasks (application) |
Prerequisites and permissions
Configure a CloudTools Connector with Connector Type set to Microsoft 365. Complete Microsoft sign-in for OAuth Delegated (Authorization Code). For endpoints supporting OAuth Application (Client Credentials), grant the required application permissions and administrator consent. The identity must have access to the target resource. See Creating an Entra ID App and Integration Connectors for setup.
The permission provider declares these alternatives; they are not cumulative requirements or a guarantee of least privilege. Check endpoint restrictions before choosing permissions.
| Permission type | Declared alternatives |
|---|---|
| Delegated | Tasks.Read, Tasks.ReadWrite, Group.Read.All, Group.ReadWrite.All |
| Application | Tasks.Read.All, Tasks.ReadWrite.All |
See the Microsoft operation and permissions reference.
Inputs
| Input | Apex field | Type | Required | Description |
|---|---|---|---|---|
| User Id or Principal Name | userIdOrPrincipalName | String | No | User id or user principal name |
| Filter Query | filterQuery | String | No | OData filter query |
| Select Query | selectQuery | String | No | OData select query |
| Expand Query | expandQuery | String | No | OData expand query |
| Order By Query | orderbyQuery | String | No | OData orderby query |
| Top Query | topQuery | String | No | OData top query |
Supply one non-null request. This implementation processes only the first request. The global input does not expose connectorId; Flow and subscriber Apex use CloudTools connector selection. Resolve dynamic values before invocation; replacement tokens are not resolved by this action.
Outputs
Returns an outer list containing one collection of MSPlannerTask items. The collection is empty if the response or value is null. This is not one output collection per input request.
| Output | Apex field | Type | Description |
|---|---|---|---|
| Id | id | String | Planner task identifier |
| Plan Id | planId | String | Planner plan identifier |
| Bucket Id | bucketId | String | Planner bucket identifier |
| Title | title | String | Planner task title |
| Order Hint | orderHint | String | Sort hint used by Planner |
| Assignee Priority | assigneePriority | String | Assignee priority sort hint |
| Percent Complete | percentComplete | Integer | Completion percentage 0-100 |
| Priority | priority | Integer | Planner priority value |
| Has Description | hasDescription | Boolean | Whether task has description details |
| Conversation Thread Id | conversationThreadId | String | Conversation thread identifier |
| Created Date Time | createdDateTime | String | Created timestamp |
| Start Date Time | startDateTime | String | Start timestamp |
| Due Date Time | dueDateTime | String | Due timestamp |
| Completed Date Time | completedDateTime | String | Completion timestamp |
| Preview Type | previewType | String | Preview type (for example, automatic) |
| Reference Count | referenceCount | Integer | Reference count |
| Checklist Item Count | checklistItemCount | Integer | Checklist item count |
| Active Checklist Item Count | activeChecklistItemCount | Integer | Active checklist item count |
| OData Type | odataType | String | OData type |
| OData ETag | odataEtag | String | OData etag |
| Additional Properties | additionalProperties | List<DynamicObject> | Additional data returned by query |
Behavior and limits
User Id or Principal Name is required for application access. Delegated access always uses /me and ignores this field.
Query inputs are forwarded as OData parameters, without checking endpoint support. List responses map only value and do not follow or expose @odata.nextLink; a result may be only the first page.
plannerAssignments is a public map on the Apex model, not a global invocable field. It is not a subscriber Apex/Flow output. LWC results expose plannerAssignmentsJson as a serialized assignment map.
Use in Flow
Add MS Planner – Tasks – Get Tasks in Flow Builder. Use a Microsoft 365 application connector configured as Set as default for Flow automations only when the endpoint supports application access. Delegated connections are not supported for CloudTools Flow automation. Supply the required values and add fault handling. This action is not a bulk operation.
Use in custom Apex
This subscriber-org example uses the Apptigent namespace. Replace the placeholders and check empty or null results. Arrange connector authorization first, run in a context that permits callouts, and handle exceptions in the caller.
Apptigent.GetMSPlannerTasks.GetMSPlannerTasksInput request =
new Apptigent.GetMSPlannerTasks.GetMSPlannerTasksInput();
request.userIdOrPrincipalName = 'someone@example.com';
List<List<Apptigent.MSPlannerTask>> results =
Apptigent.GetMSPlannerTasks.getTasks(
new List<Apptigent.GetMSPlannerTasks.GetMSPlannerTasksInput>{ request }
);
System.debug(results);
Use in a Lightning Web Component
Use getMSPlannerTasks from msPlannerConnectorLib through MSPlannerConnectorController. The function accepts a request object and an optional connector record ID as its second argument. That ID takes precedence over request.connectorId. The controller passes the selection through MSPlannerAction; it is not a field on the global invocable input. These c/ imports apply in the same namespace.
plannerActionExample.js
import { LightningElement } from 'lwc';
import { getMSPlannerTasks, MSPlannerObjects } from 'c/msPlannerConnectorLib';
export default class PlannerActionExample extends LightningElement {
result = null;
errorMessage = '';
isRunning = false;
completed = false;
async handleRun() {
if (this.isRunning || this.completed) return;
this.isRunning = true;
this.errorMessage = '';
try {
const request = MSPlannerObjects.inputs.plan();
request.userIdOrPrincipalName = 'someone@example.com';
this.result = await getMSPlannerTasks(
request, 'REPLACE_WITH_CONNECTOR_RECORD_ID'
);
this.completed = true;
} catch (error) {
this.errorMessage = error.requiresInteractiveAuthorization
? 'Sign in to Microsoft for the connector, then try again.'
: error.message || 'The Planner action failed.';
} finally {
this.isRunning = false;
}
}
}
plannerActionExample.html
<template>
<lightning-button label="Run action" onclick={handleRun}
disabled={isRunning}></lightning-button>
<p role="alert">{errorMessage}</p>
</template>
The library resolves to an array of mapped resource objects. rawJson serializes the mapped Apex object, not the untouched Graph response. Use getMSPlannerAuthorizationState, beginMSPlannerAuthorization, and createMSPlannerOAuthMessageHandler to arrange delegated sign-in. The library normalizes controller errors but does not automatically sign in or retry.
Reset completed for a new deliberate operation. If a failed mutation has an uncertain outcome, inspect the resource before retrying. An empty update result can represent a successful operation with no response body.
Error handling and troubleshooting
| Symptom | What to check |
|---|---|
| Required fields error | Supply a nonempty request list, a non-null first request, and all required fields. |
| Authorization or access denied | Check connector selection, sign-in, permissions, administrator consent, and resource access. |
| Resource not found | Use Microsoft Graph identifiers and retain each task or bucket with its source plan. Check documented 404 behavior. |
| Concurrency failure | Refresh the exact resource ETag before retrying; details use separate ETags. |
| Missing fields or items | Check query support, first-page behavior, empty PATCH responses, and model mapping limits. |
| Operation rejected | Inspect the Microsoft error, supported endpoint and body properties, JSON structure, and If-Match behavior. |