Skip to content

Outlook calendar

Where: Menu → Manage → Integrations → Teams, Slack & calendar → Calendar

Outlook calendar

Appointments straight into people’s Outlook calendars:

  • when someone books a live session or a mentoring appointment, the academy writes the entry into their Outlook calendar (shown as busy, with a reminder 15 minutes before and a link to the academy);
  • a change of the appointment updates the entry, a cancellation deletes it; if the person deleted the entry in Outlook, a change puts it back;
  • the mail about the booking still goes out, without a calendar file, and says “The appointment is in your Outlook calendar.”;
  • whoever the academy can’t reach in Outlook (people outside your Microsoft 365 organisation, or when Outlook refuses) gets the calendar invitation by email as before.

It uses the Entra app registration of your Microsoft sign-in, with the Microsoft Graph application permission Calendars.ReadWrite. Nothing is registered at Microsoft on the Academy’s side.

Step Where Role needed
1 The Microsoft sign-in, switched on the academy (Manage → Sign-in) Administrator of your organisation; see “Company sign-in” for the Entra side
2 Graph permission Calendars.ReadWrite Microsoft Entra admin centre Adding it: Application Administrator or Cloud Application Administrator, or an owner of the app registration. Granting admin consent: Privileged Role Administrator or Global Administrator (the two roles before can’t consent to Microsoft Graph application permissions)
3 Limit the app to some mailboxes (recommended) Exchange admin centre and Exchange Online PowerShell Member of the Exchange role group Organization Management, or the Entra role Exchange Administrator. Removing the Entra consent again (option A) needs the roles for consent of step 2
4 Choose the sign-in, switch on, test the academy Administrator of your organisation
  1. Set up the Microsoft sign-in under Manage → Sign-in and switch it on, if it isn’t there yet (see “Company sign-in”). Until there is one, the section only says Set up the Microsoft sign-in (Entra ID) under Sign-in first; Outlook uses its app registration.
  2. The sub-tab Calendar (section Outlook calendar) lists the three steps. Note which sign-in you’ll use: its app registration is the one to change at Microsoft.

2. Microsoft Entra: the permission Calendars.ReadWrite

Section titled “2. Microsoft Entra: the permission Calendars.ReadWrite”

Calendars.ReadWrite as an application permission lets the app write to every mailbox of your organisation. Step 3 limits that; decide on step 3 before you grant consent here.

In the Microsoft Entra admin centre (entra.microsoft.com):

  1. Go to Entra ID → App registrations → All applications and open the app registration of your Microsoft sign-in. Its Application (client) ID is the client id of the sign-in under Manage → Sign-in.
  2. Open API permissions → Add a permission → Microsoft Graph → Application permissions.
  3. Search for Calendars.ReadWrite, tick it and click Add permissions.
  4. Click Grant admin consent for and confirm. This needs a Privileged Role Administrator or a Global Administrator. The status of the permission turns to “Granted”.

If you limit the app with RBAC for Applications (option A of step 3), leave out item 4: there, Exchange grants the permission instead.

Section titled “3. Exchange: limit the app to some mailboxes (recommended)”

The academy only writes to the calendars of people who book something. Exchange can make sure the app can’t reach any other mailbox. Microsoft offers two ways:

  • Option A: RBAC for Applications. Microsoft’s current way. Exchange grants Calendars.ReadWrite for a set of mailboxes only, and the consent in Entra is not given (or taken back): Exchange adds its grant to Entra’s, so with both the limit has no effect.
  • Option B: an application access policy. The older way: the consent in Entra stays, and a policy restricts it to the members of a group. Microsoft now writes that new policies shouldn’t be created, because they will have to be moved to RBAC for Applications later. Use it only if your organisation works with such policies already.

Both are set up in Exchange Online PowerShell (see “Set up with PowerShell” below). Both need a group of the mailboxes the app may use. You can make it in the Exchange admin centre (admin.exchange.microsoft.com):

  1. Go to Recipients → Groups → Mail-enabled security and click Add a group.
  2. Under Choose a group type, choose Mail-enabled security and click Next; under Set up the basics, enter a name (for example “Academy calendar”) and click Next.
  3. Assign an owner, then under Add members add the people who learn, and click Next.
  4. Enter the group’s email address, click Next, then Create group.

Put yourself in the group too: the academy’s test writes into the calendar of the administrator who clicks it. With option A, only direct members of the group count, not members of groups inside it.

Changes in Exchange take effect after a while: for RBAC for Applications, Microsoft names 30 minutes to 2 hours.

  1. Under Microsoft sign-in, choose the sign-in whose app registration you changed, and click Switch on.
  2. Click Test with my calendar. The academy puts a short entry into your own Outlook calendar for tomorrow and takes it out again at once. When it worked, it shows Outlook accepted a test entry and it has been removed again.
  3. The section now shows On and when the academy last wrote to Outlook (Nothing written yet. until the first booking). After a failed write it shows Problem with Microsoft’s answer below it.

Switch off stops writing to Outlook. Entries already there stay; later changes of those appointments go out as invitations by email.

Step 2 and the limit of step 3 can be done with PowerShell. These are single commands to copy, not a script: paste each block into the same PowerShell window, check its output, then go on.

Values. Take them from your sign-in under Manage → Sign-in and from Microsoft Entra:

Terminal window
$TenantId = "<directory (tenant) id>"
$ClientId = "<client id of the Microsoft sign-in's app registration>"
$Admin = "<your admin address, e.g. admin@example.com>"
$GroupName = "Academy calendar"
$GroupAlias = "academy-calendar"
$ScopeName = "Academy calendar mailboxes"

Install the modules once:

Terminal window
Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Applications -Scope CurrentUser
Terminal window
Install-Module ExchangeOnlineManagement -Scope CurrentUser

Step 2: Calendars.ReadWrite. Adding it needs the roles of step 2:

Terminal window
Connect-MgGraph -TenantId $TenantId -Scopes "Application.ReadWrite.All","AppRoleAssignment.ReadWrite.All"
Terminal window
$app = Get-MgApplication -Filter "appId eq '$ClientId'"
$app | Format-List DisplayName, AppId

Check that this is the app registration of your Microsoft sign-in before going on.

Terminal window
$graph = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'"
$role = $graph.AppRoles | Where-Object Value -eq "Calendars.ReadWrite"
$rra = @($app.RequiredResourceAccess)
$g = $rra | Where-Object ResourceAppId -eq $graph.AppId
if (-not $g) { $g = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphRequiredResourceAccess]@{ ResourceAppId = $graph.AppId; ResourceAccess = @() }; $rra += $g }
if (-not ($g.ResourceAccess | Where-Object Id -eq $role.Id)) { $g.ResourceAccess += [Microsoft.Graph.PowerShell.Models.MicrosoftGraphResourceAccess]@{ Id = $role.Id; Type = "Role" } }
Update-MgApplication -ApplicationId $app.Id -RequiredResourceAccess $rra

Admin consent (Privileged Role Administrator or Global Administrator). Leave this out with option A:

Terminal window
$sp = Get-MgServicePrincipal -Filter "appId eq '$ClientId'"
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $sp.Id -PrincipalId $sp.Id -ResourceId $graph.Id -AppRoleId $role.Id

Step 3: the group. In Exchange Online PowerShell (Organization Management or Exchange Administrator):

Terminal window
Connect-ExchangeOnline -UserPrincipalName $Admin
Terminal window
New-DistributionGroup -Name $GroupName -Alias $GroupAlias -Type Security -Members $Admin, "<learner 1>", "<learner 2>"

More people later:

Terminal window
Add-DistributionGroupMember -Identity $GroupName -Member "<address>"

Step 3, option A: RBAC for Applications. First the scope of the group’s mailboxes:

Terminal window
$dn = (Get-DistributionGroup -Identity $GroupName).DistinguishedName
New-ManagementScope -Name $ScopeName -RecipientRestrictionFilter "MemberOfGroup -eq '$dn'"

Then Exchange’s pointer to the app. It needs the Object ID of the app’s service principal, which is the one under Entra ID → Enterprise apps → All applications → the app, not the one in App registrations. With the Graph connection from step 2:

Terminal window
$sp = Get-MgServicePrincipal -Filter "appId eq '$ClientId'"
New-ServicePrincipal -AppId $ClientId -ObjectId $sp.Id -DisplayName "Academy calendar"

The permission, for the scope only:

Terminal window
New-ManagementRoleAssignment -App $sp.Id -Role "Application Calendars.ReadWrite" -CustomResourceScope $ScopeName

Check: for a member, InScope must be True; for someone outside the group, False.

Terminal window
Test-ServicePrincipalAuthorization -Identity $sp.Id -Resource "<address of a member>" | Format-Table
Terminal window
Test-ServicePrincipalAuthorization -Identity $sp.Id -Resource "<address of someone outside the group>" | Format-Table

If Calendars.ReadWrite was granted in Entra before, take that consent back, or the limit has no effect. This removes only Calendars.ReadWrite; other permissions of the app (for example TeamsActivity.Send for the Teams app) stay:

Terminal window
Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $sp.Id | Where-Object { $_.ResourceId -eq $graph.Id -and $_.AppRoleId -eq $role.Id } | ForEach-Object { Remove-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $sp.Id -AppRoleAssignmentId $_.Id }

Step 3, option B: an application access policy (only where your organisation uses these already; the consent in Entra stays):

Terminal window
New-ApplicationAccessPolicy -AccessRight RestrictAccess -AppId $ClientId -PolicyScopeGroupId "<email address of the group>" -Description "Academy calendar"

Check, for a member and for someone outside the group:

Terminal window
Test-ApplicationAccessPolicy -Identity "<address>" -AppId $ClientId

Then do step 4 in the academy.

“Set up the Microsoft sign-in (Entra ID) under Sign-in first; Outlook uses its app registration.” There is no Microsoft sign-in yet. Set one up under Manage → Sign-in (see “Company sign-in”).

“The provider couldn’t be reached or answered with an error. Please try again in a moment. Answer: Microsoft Outlook: …” (after Test with my calendar) The test entry couldn’t be made. The text after “Microsoft Outlook:” says why, and the same text shows under Problem in the section:

  • “Microsoft sign-in failed (…): AADSTS7000215: …” (invalid client secret) The client secret the sign-in keeps isn’t valid for this app registration. Make a new one in Entra (Certificates & secrets) and enter it under Manage → Sign-in with Replace client ID or secret.
  • “… AADSTS7000222: …” The client secret has expired. As before: a new secret, then Replace client ID or secret.
  • “… AADSTS700016: …” Microsoft found no app with this client id in your directory. Check the client id and the directory (tenant) id of the sign-in.
  • “Microsoft Graph answered 403 ErrorAccessDenied” The app may not write to this calendar:
    1. Calendars.ReadWrite isn’t granted: under API permissions its status isn’t “Granted” (step 2), or with option A the role assignment is missing.
    2. Your own mailbox is outside the limit of step 3: add yourself to the group.
    3. The change in Exchange isn’t active yet: wait up to 2 hours and test again.
  • “Microsoft Graph answered … MailboxNotEnabledForRESTAPI” Microsoft says the mailbox is inactive, soft-deleted or hosted on-premises. The account needs a mailbox in Exchange Online.
  • “Microsoft Graph answered 404 …” Graph found no mailbox for you: your email address here isn’t an address of your Microsoft 365 mailbox.
  • “Microsoft Graph answered 429” or “… 503” Microsoft is busy or limiting requests. Test again later.
  • “the entry could not be made” The academy couldn’t try: the chosen Microsoft sign-in isn’t switched on (Manage → Sign-in), for example after its client id or secret was replaced and not tested again. Switch the sign-in on, or choose a switched-on one and click Save.

The section shows “Problem”, but the test works. The status shows the last write for anyone. One person outside your Microsoft 365 organisation, or one whose mailbox is outside the limit, is enough; they got the invitation by email instead. The next successful write clears it.

Someone sees their appointments twice. They also subscribed to their calendar address under My account → Calendar. They can remove the subscription in Outlook, or the address in the academy.

Entries stay in Outlook after “Switch off”. That is intended: the academy doesn’t remove entries it made. Later changes and cancellations of those appointments come as invitations by email.