MS Entra – Calendars – Get Calendar

Estimated reading: 5 minutes

MS Entra – Calendars – Get Calendar

Get a specific calendar by user or group.

Action details

PropertyValue
Action labelMS Entra – Calendars – Get Calendar
CategoryCloudTools
Apex class and methodGetMSGraphCalendar.getCalendar
Input typeGetMSGraphCalendar.GetMSGraphCalendarInput
Output typeList<MSGraphCalendar>
AuthorizationMicrosoft 365 connector; supported authorization depends on the endpoint and target.
Microsoft Graph requestGET /me/calendar or /me/calendars/{calendarId}; /users/{userEmail}/calendar or /users/{userEmail}/calendars/{calendarId}; group target where supported by the action

Prerequisites and permissions

Configure a CloudTools Connector with Connector Type set to Microsoft 365. Complete sign-in for OAuth Delegated (Authorization Code). For supported OAuth Application (Client Credentials) requests, grant application permissions and administrator consent. The identity must have access to the selected resource; directory operations can also require Microsoft Entra roles. Use Creating an Entra ID App and Integration Connectors for setup.

The action permission provider declares these alternatives. They are not cumulative requirements, not all are least privileged, and a scope can have target-specific restrictions. Check the Microsoft operation reference before selecting permissions.

Permission typeDeclared alternatives
DelegatedCalendars.ReadBasic, Calendars.Read, Calendars.ReadWrite, Group.Read.All, Group.ReadWrite.All
ApplicationCalendars.ReadBasic, Calendars.Read, Calendars.ReadWrite

Endpoints: /me/calendar; /users/{idOrUserPrincipalName}/calendar; /me/calendars/{calendar-id}; /users/{idOrUserPrincipalName}/calendars/{calendar-id}; /groups/{group-id}/calendar; /groups/{group-id}/calendar/{calendar-id}. Group calendars use Group.Read.All or Group.ReadWrite.All with delegated access; application access to group calendars is not supported.

See the Microsoft operation and permissions reference.

Inputs

InputApex fieldTypeRequiredDescription
User EmailuserEmailStringNoEmail address of the user
Group IdgroupIdStringNoGroup identifier (not group email)
Calendar IdcalendarIdStringNoCalendar identifier (leave empty for default calendar)

Supply a nonempty list with a non-null first request. Graph actions process only that first request. Global inputs do not expose connectorId; subscriber Apex and Flow use CloudTools connector selection. Use Microsoft Graph resource IDs or the specifically documented user identifier, and resolve dynamic values before invocation.

Outputs

Returns one mapped MSGraphCalendar inside a list. Check the actual result shape and fields before use. Microsoft 404 responses are treated as a missing resource.

OutputApex fieldTypeDescription
IdidStringCalendar id
NamenameStringCalendar name
ColorcolorStringCalendar color
Change KeychangeKeyStringChange key
Can EditcanEditBooleanWhether the user can edit the calendar
Can SharecanShareBooleanWhether the user can share the calendar
Can View Private ItemscanViewPrivateItemsBooleanWhether private items are visible
OwnerownerMSGraphCalendarEmailCalendar owner

Behavior and limits

Delegated authorization can select /me for user-calendar operations. Outside delegated access, supply the target user required by runtime validation; optional invocable user fields can still be conditionally required.

Use either the user target or Group Id as documented; the action rejects supplying both. Group calendar/event support differs from user calendars and generally requires delegated group permissions. A group endpoint exposed by the connector is not a guarantee that every calendar operation is supported there.

An empty Calendar Id selects the default calendar. For a group, the implementation uses /groups/{groupId}/calendar; confirm the behavior of any supplied calendar ID in the Microsoft reference.

Use in Flow

Use MS Entra – Calendars – Get Calendar where supported. Use a Microsoft 365 application connector configured as Set as default for Flow automations only if the endpoint and target support application access. Supply required values, retain useful outputs, and add fault handling. Delegated connections are not supported for CloudTools Flow automation. The action processes only the first input request.

Use in custom Apex

This subscriber-org example uses the Apptigent namespace. Replace identifiers and example values before use. Configure the connector, complete authorization first, run in a context permitting callouts, and handle exceptions, empty results, and unmapped fields.

Apptigent.GetMSGraphCalendar.GetMSGraphCalendarInput request =
    new Apptigent.GetMSGraphCalendar.GetMSGraphCalendarInput();
request.userEmail = 'someone@example.com';
request.calendarId = 'REPLACE_WITH_CALENDAR_ID';



List<Apptigent.MSGraphCalendar> results =
    Apptigent.GetMSGraphCalendar.getCalendar(
        new List<Apptigent.GetMSGraphCalendar.GetMSGraphCalendarInput>{ request }
    );
System.debug(results);

Use in a Lightning Web Component

Use getMSGraphCalendar from msEntraConnectorLib through MSEntraConnectorController. These c/ imports apply in the same namespace. Set request.connectorId for direct MSEntraAction calls. The controller captures the request selection for MSEntraAction.

Global inputLWC request mapping
userEmailrequest.userIdOrPrincipalName
groupIdrequest.groupId
calendarIdrequest.calendarId

entraActionExample.js

import { LightningElement } from 'lwc';
import { getMSGraphCalendar } from 'c/msEntraConnectorLib';

export default class EntraActionExample 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 = { connectorId: 'REPLACE_WITH_CONNECTOR_RECORD_ID' };
            request.userIdOrPrincipalName = 'someone@example.com';
            request.calendarId = 'REPLACE_WITH_CALENDAR_ID';
            this.result = await getMSGraphCalendar(request);
            this.completed = true;
        } catch (error) {
            this.errorMessage = error.requiresInteractiveAuthorization
                ? 'Sign in to Microsoft for the connector, then try again.'
                : error.message || 'The Entra action failed.';
        } finally {
            this.isRunning = false;
        }
    }
}

entraActionExample.html

<template>
    <lightning-button label="Run action" onclick={handleRun}
        disabled={isRunning}></lightning-button>
    <p role="alert">{errorMessage}</p>
</template>

The library returns one mapped DTO or null. The controller can flatten nested fields, serialize data, or map an action result into an operation DTO. rawJson contains serialized mapped Apex data rather than the untouched Graph response.

Use getMSEntraAuthorizationState, beginMSEntraAuthorization, and createMSEntraOAuthMessageHandler to arrange delegated sign-in. The library normalizes errors but does not automatically sign in or retry. Reset completed for a new deliberate operation, and inspect resource state before retrying a mutation with an uncertain outcome.

Error handling and troubleshooting

SymptomWhat to check
Required fields errorSupply a nonempty request list and required or conditionally required inputs. For LWC, use the mapped field names.
Authorization or access deniedCheck connector selection, sign-in, endpoint/target permission support, administrator consent, directory roles, and resource access.
Resource not foundCheck Microsoft IDs and parent resource relationships. Preserve group/drive/item associations and mailbox/calendar/event IDs.
Missing or unexpected outputCheck query support, pagination, wrapper versus item models, public-only properties, and mapped DTO fields.
Operation rejectedInspect the Microsoft error, supported writable fields, group/calendar restrictions, recipient/license data, and file transfer limits.

See Entra connector introduction.

Share this Doc

MS Entra – Calendars – Get Calendar

Or copy link

CONTENTS

Free eBook: The Ultimate Guide to Power Platform Custom Connectors

Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot avatar
What can I help you with?

Subscribe

×
Cancel