MS Entra – Events – Create Event
MS Entra – Events – Create Event
Create an event for a user calendar.
Action details
| Property | Value |
|---|---|
| Action label | MS Entra – Events – Create Event |
| Category | CloudTools |
| Apex class and method | CreateMSGraphEvent.createEvent |
| Input type | CreateMSGraphEvent.CreateMSGraphEventInput |
| Output type | List<MSGraphEvent> |
| Authorization | Microsoft 365 connector; supported authorization depends on the endpoint and target. |
| Microsoft Graph request | POST /me/calendar/events or the selected user/calendar path; group event path where exposed |
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 type | Declared alternatives |
|---|---|
| Delegated | Calendars.ReadWrite |
| Application | Calendars.ReadWrite |
Endpoints: /me/calendar/events; /me/calendars/{calendar-id}/events; /users/{idOrUserPrincipalName}/calendar/events; /users/{idOrUserPrincipalName}/calendars/{calendar-id}/events
See the Microsoft operation and permissions reference.
Inputs
| Input | Apex field | Type | Required | Description |
|---|---|---|---|---|
| User Email | userEmail | String | No | Email address of the user |
| Calendar Id | calendarId | String | No | Calendar identifier (leave empty for default calendar) |
| Subject | subject | String | No | The text of the event subject. |
| Body Content Type | bodyContentType | String | No | The body content type. Possible values: text, html. |
| Body Content | bodyContent | String | No | The body of the event. The content type can be text or HTML. |
| Start Date Time | startDateTime | String | Yes | The start date and time of the event (ISO 8601). Example: 2019-03-15T09:00:00 |
| Start Time Zone | startTimeZone | String | Yes | The time zone for the start date and time. Example: Pacific Standard Time. |
| End Date Time | endDateTime | String | Yes | The end date and time of the event (ISO 8601). Example: 2019-03-15T10:00:00 |
| End Time Zone | endTimeZone | String | Yes | The time zone for the end date and time. Example: Pacific Standard Time. |
| Original Start Time Zone | originalStartTimeZone | String | No | Original start timezone for the event. |
| Original End Time Zone | originalEndTimeZone | String | No | Original end timezone for the event. |
| Location Display Name | locationDisplayName | String | No | The location name displayed in the event. |
| Location Street | locationStreet | String | No | Street address of the event location. |
| Location City | locationCity | String | No | City of the event location. |
| Location State | locationState | String | No | State of the event location. |
| Location Country Or Region | locationCountryOrRegion | String | No | Country or region of the event location. |
| Location Postal Code | locationPostalCode | String | No | Postal code of the event location. |
| Is All Day | isAllDay | Boolean | No | Set to true if the event is an all day event. |
| Show As | showAs | String | No | The status shown during the event: free, tentative, busy, oof, workingElsewhere, unknown. |
| Importance | importance | String | No | The importance of the event: low, normal, high. |
| Sensitivity | sensitivity | String | No | The sensitivity of the event: normal, personal, private, confidential. |
| Categories | categories | List<String> | No | Categories associated with the event. |
| Is Reminder On | isReminderOn | Boolean | No | Set to true if an alert is set to remind the user of the event. |
| Reminder Minutes Before Start | reminderMinutesBeforeStart | Integer | No | The number of minutes before the event start time to show the reminder. |
| Is Online Meeting | isOnlineMeeting | Boolean | No | Set to true if this event has online meeting information. |
| Online Meeting Provider | onlineMeetingProvider | String | No | The online meeting provider: teamsForBusiness, skypeForBusiness, skypeForConsumer, unknown. |
| Attendees | attendeesCsv | String | No | Comma-delimited list of attendee email addresses. |
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 MSGraphEvent inside a list. Check the actual result shape and fields before use. This implementation creates a default result object when the response is null; an object alone does not prove that a resource was returned.
| Output | Apex field | Type | Description |
|---|---|---|---|
| id | id | String | Mapped drive item property; populated only when returned and supported by the resource. |
| odataEtag | odataEtag | String | Mapped drive item property; populated only when returned and supported by the resource. |
| subject | subject | String | Mapped drive item property; populated only when returned and supported by the resource. |
| bodyPreview | bodyPreview | String | Mapped drive item property; populated only when returned and supported by the resource. |
| body | body | MSGraphEventBody | Mapped drive item property; populated only when returned and supported by the resource. |
| startTime | startTime | MSGraphDateTimeTimeZone | Mapped drive item property; populated only when returned and supported by the resource. |
| endTime | endTime | MSGraphDateTimeTimeZone | Mapped drive item property; populated only when returned and supported by the resource. |
| originalStartTimeZone | originalStartTimeZone | String | Mapped drive item property; populated only when returned and supported by the resource. |
| originalEndTimeZone | originalEndTimeZone | String | Mapped drive item property; populated only when returned and supported by the resource. |
| location | location | MSGraphEventLocation | Mapped drive item property; populated only when returned and supported by the resource. |
| isAllDay | isAllDay | Boolean | Mapped drive item property; populated only when returned and supported by the resource. |
| showAs | showAs | String | Mapped drive item property; populated only when returned and supported by the resource. |
| isCancelled | isCancelled | Boolean | Mapped drive item property; populated only when returned and supported by the resource. |
| isOrganizer | isOrganizer | Boolean | Mapped drive item property; populated only when returned and supported by the resource. |
| importance | importance | String | Mapped drive item property; populated only when returned and supported by the resource. |
| sensitivity | sensitivity | String | Mapped drive item property; populated only when returned and supported by the resource. |
| categories | categories | List<String> | Mapped drive item property; populated only when returned and supported by the resource. |
| createdDateTime | createdDateTime | String | Mapped drive item property; populated only when returned and supported by the resource. |
| lastModifiedDateTime | lastModifiedDateTime | String | Mapped drive item property; populated only when returned and supported by the resource. |
| changeKey | changeKey | String | Mapped drive item property; populated only when returned and supported by the resource. |
| iCalUId | iCalUId | String | Mapped drive item property; populated only when returned and supported by the resource. |
| webLink | webLink | String | Mapped drive item property; populated only when returned and supported by the resource. |
| isReminderOn | isReminderOn | Boolean | Mapped drive item property; populated only when returned and supported by the resource. |
| reminderMinutesBeforeStart | reminderMinutesBeforeStart | Integer | Mapped drive item property; populated only when returned and supported by the resource. |
| eventType | eventType | String | Mapped drive item property; populated only when returned and supported by the resource. |
| onlineMeetingUrl | onlineMeetingUrl | String | Mapped drive item property; populated only when returned and supported by the resource. |
| isOnlineMeeting | isOnlineMeeting | Boolean | Mapped drive item property; populated only when returned and supported by the resource. |
| onlineMeetingProvider | onlineMeetingProvider | String | Mapped drive item property; populated only when returned and supported by the resource. |
| organizer | organizer | MSGraphEventOrganizer | Mapped drive item property; populated only when returned and supported by the resource. |
| responseStatus | responseStatus | MSGraphEventResponseStatus | Mapped drive item property; populated only when returned and supported by the resource. |
| attendees | attendees | List<MSGraphEventAttendee> | Mapped drive item property; populated only when returned and supported by the resource. |
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.
Start and end date/time and time zone values are required. Attendees CSV is converted to attendee objects. Creating an event can send meeting invitations; a returned event does not imply attendees accepted it. Online meeting support depends on mailbox capabilities and the selected provider.
Use in Flow
Use MS Entra – Events – Create Event 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.CreateMSGraphEvent.CreateMSGraphEventInput request =
new Apptigent.CreateMSGraphEvent.CreateMSGraphEventInput();
request.userEmail = 'someone@example.com';
request.calendarId = 'calendar-id';
request.subject = 'Standup';
request.bodyContentType = 'text';
request.bodyContent = 'Daily sync';
request.startDateTime = '2026-10-13T09:00:00';
request.startTimeZone = 'UTC';
request.endDateTime = '2026-10-13T10:00:00';
request.endTimeZone = 'UTC';
request.originalStartTimeZone = 'Pacific Standard Time';
request.originalEndTimeZone = 'Pacific Standard Time';
request.locationDisplayName = 'Conf Room';
request.locationStreet = '123 Main St';
request.locationCity = 'Seattle';
request.locationState = 'WA';
request.locationCountryOrRegion = 'US';
request.locationPostalCode = '98101';
request.isAllDay = false;
request.showAs = 'busy';
request.importance = 'normal';
request.sensitivity = 'normal';
request.categories = new List<String>{ /* supply values for this operation */ };
request.isReminderOn = true;
request.reminderMinutesBeforeStart = 15;
request.isOnlineMeeting = true;
request.onlineMeetingProvider = 'teamsForBusiness';
request.attendeesCsv = 'alex.wilber@example.com,adele.vance@example.com';
List<Apptigent.MSGraphEvent> results =
Apptigent.CreateMSGraphEvent.createEvent(
new List<Apptigent.CreateMSGraphEvent.CreateMSGraphEventInput>{ request }
);
System.debug(results);
Use in a Lightning Web Component
Use createMSGraphEvent 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 input | LWC request mapping |
|---|---|
userEmail | request.userIdOrPrincipalName |
calendarId | request.calendarId |
subject | request.subject |
bodyContentType | request.bodyContentType |
bodyContent | request.bodyContent |
startDateTime | request.startDateTime |
startTimeZone | request.startTimeZone |
endDateTime | request.endDateTime |
endTimeZone | request.endTimeZone |
originalStartTimeZone | request.originalStartTimeZone |
originalEndTimeZone | request.originalEndTimeZone |
locationDisplayName | request.locationDisplayName |
locationStreet | request.locationStreet |
locationCity | request.locationCity |
locationState | request.locationState |
locationCountryOrRegion | request.locationCountryOrRegion |
locationPostalCode | request.locationPostalCode |
isAllDay | request.isAllDay |
showAs | request.showAs |
importance | request.importance |
sensitivity | request.sensitivity |
categories | request.categories |
isReminderOn | request.isReminderOn |
reminderMinutesBeforeStart | request.reminderMinutesBeforeStart |
isOnlineMeeting | request.isOnlineMeeting |
onlineMeetingProvider | request.onlineMeetingProvider |
attendeesCsv | request.attendeesCsv |
entraActionExample.js
import { LightningElement } from 'lwc';
import { createMSGraphEvent } 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 = 'calendar-id';
request.subject = 'Standup';
request.bodyContentType = 'text';
request.bodyContent = 'Daily sync';
request.startDateTime = '2026-10-13T09:00:00';
request.startTimeZone = 'UTC';
request.endDateTime = '2026-10-13T10:00:00';
request.endTimeZone = 'UTC';
request.originalStartTimeZone = 'Pacific Standard Time';
request.originalEndTimeZone = 'Pacific Standard Time';
request.locationDisplayName = 'Conf Room';
request.locationStreet = '123 Main St';
request.locationCity = 'Seattle';
request.locationState = 'WA';
request.locationCountryOrRegion = 'US';
request.locationPostalCode = '98101';
request.isAllDay = false;
request.showAs = 'busy';
request.importance = 'normal';
request.sensitivity = 'normal';
request.categories = ['REPLACE_WITH_VALUE'];
request.isReminderOn = true;
request.reminderMinutesBeforeStart = 15;
request.isOnlineMeeting = true;
request.onlineMeetingProvider = 'teamsForBusiness';
request.attendeesCsv = 'alex.wilber@example.com,adele.vance@example.com';
this.result = await createMSGraphEvent(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
| Symptom | What to check |
|---|---|
| Required fields error | Supply a nonempty request list and required or conditionally required inputs. For LWC, use the mapped field names. |
| Authorization or access denied | Check connector selection, sign-in, endpoint/target permission support, administrator consent, directory roles, and resource access. |
| Resource not found | Check Microsoft IDs and parent resource relationships. Preserve group/drive/item associations and mailbox/calendar/event IDs. |
| Missing or unexpected output | Check query support, pagination, wrapper versus item models, public-only properties, and mapped DTO fields. |
| Operation rejected | Inspect the Microsoft error, supported writable fields, group/calendar restrictions, recipient/license data, and file transfer limits. |