Skip to content

fix: MSTeams not created as online meetings #21377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Aug 11, 2025

Conversation

vijayraghav-io
Copy link
Contributor

@vijayraghav-io vijayraghav-io commented May 17, 2025

What does this PR do?

Visual Demo (For contributors especially)

Video Demo:

Before fix (or issue):
https://www.loom.com/share/87082087c5f64e368494ec6aea834a48?sid=4c3724fa-5c6a-4a57-8b25-d32e6989404d

After fix :
https://www.loom.com/share/75f976cf3b6f4b27b5da3301089fb2fd?sid=fe926a95-9953-4797-a7f0-bc6524f35c83

Changes in /apps/msteams (MSTeams installation page with dependency added)
https://www.loom.com/share/2881ab3bf573453585a029016c82b3ba?sid=478b4496-9112-43b0-a3db-f6050a2baaf3

Image Demo :

  • Add side-by-side screenshots of the original and updated change.
Before Fix After Fix
Screenshot 2025-05-17 at 9 53 17 PM Screenshot 2025-05-17 at 9 28 23 PM
Screenshot 2025-05-17 at 9 54 20 PM Screenshot 2025-05-17 at 9 29 35 PM
Screenshot 2025-05-20 at 12 36 02 AM Screenshot 2025-05-20 at 12 34 58 AM
Screenshot 2025-05-17 at 11 13 59 PM This endpoint does not create an onlineMeeting. For MSTeam event to look as onlineMeeting it should be associated with an event or in other words it should be created using `/events` endpoint as recommended here

https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=javascript#example-4-create-and-enable-an-event-as-an-online-meeting

with key properties set allowNewTimeProposals: true , isOnlineMeeting: true, onlineMeetingProvider: 'teamsForBusiness'

  • Also duplicate events or emails were generated because a event was created on outlook calendar using calendar service, and /onlineMeetings also created an event on same calendar by office365video/lib/VideoApiAdapter.

  • Implemented a check in this PR -> to not create meeting using office365video/lib/videoApiAdapter, but the office365calendar/lib/CalendarService with /events endpoint will be used to create onlineMeeting by passing required parameters..

  • Also the body content should be of type HTML and html content has to be input in body for /event endpoint , for the texts and content to look good along with Microsoft Teams details at the end of the body with meeting details. This resolves content not looking good.

  • MSTeams automatically send mails to attendees with the body passed in /events endpoint. Also appending its meeting details like url, passcode, id,...

  • Added a dependency to MSTeams installation in app-store, this suggests or warns user if they are trying to install MSTeams without outlook calendar and recommends to install outlook calendar first.

  • Also updated the updateEvent in office365calendar/lib/CalendarService.ts
    updateEvent updates or moves the meeting without loosing its onlineMeeting feature by getting the meeting blob first in the existing body and then patching it. Without this blob patch the updated meeting becomes non-onlineMeeting (or without msTeams feature)
    https://learn.microsoft.com/en-us/graph/api/event-update?view=graph-rest-1.0&tabs=javascript

Screenshot 2025-05-17 at 11 42 19 PM

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • - N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.
    This functionality test requires verification on external app - MSTeams and can be verified visually.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
    Install Microsoft outlook calendar and MS teams with a work account for a organizer in cal
  • What is expected (happy path) to have (input and output)?
    The events on MS teams should be created as online meetings.
    The text should be formatted correctly inside this event on MS teams.
    The buttons 'Join' , label 'Microsoft Teams Meeting' for location should be visible.
    It should be marked as online meeting when event is opened to edit.
    Should be able to reschedule and the rescheduled event should also be 'online meeting'.
  • Any other important info that could help to test that PR

Summary by mrge

Fixed an issue where MS Teams events were not created as online meetings and prevented duplicate calendar events in Outlook when using MS Teams.

  • Bug Fixes
    • Ensured MS Teams events are always marked as online meetings with correct formatting and join links.
    • Skipped creating duplicate Outlook calendar events when a Teams meeting is already created.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label May 17, 2025
@graphite-app graphite-app bot requested a review from a team May 17, 2025 16:41
Copy link

vercel bot commented May 17, 2025

@vijayraghav-io is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added $500 calendar-apps area: calendar, google calendar, outlook, lark, microsoft 365, apple calendar emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email High priority Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync 🐛 bug Something isn't working 💎 Bounty A bounty on Algora.io 🧹 Improvements Improvements to existing features. Mostly UX/UI labels May 17, 2025
@dosubot dosubot bot added the app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar label May 17, 2025
Copy link

graphite-app bot commented May 17, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (05/17/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add community label" took an action on this PR • (05/17/25)

1 label was added to this PR based on Keith Williams's automation.

@@ -6,7 +6,7 @@ import { WEBAPP_URL_FOR_OAUTH } from "@calcom/lib/constants";
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
import { encodeOAuthState } from "../../_utils/oauth/encodeOAuthState";

export const OFFICE365_VIDEO_SCOPES = ["OnlineMeetings.ReadWrite", "offline_access"];
export const OFFICE365_VIDEO_SCOPES = ["OnlineMeetings.ReadWrite", "offline_access", "Calendars.ReadWrite"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break all active users who have already installed MS Teams. Changing a scope directly is high-risk

@anikdhabal anikdhabal closed this May 17, 2025
@vijayraghav-io
Copy link
Contributor Author

@vijayraghav-io thanks for your work. But it looks more like a workaround, also i am already working on it. Closing it for now

Please note, this is not work around.
The other approach would be to update createEvent() function in office365Calendar Service to include 'isOnlineMeeting' property to true , if MSTeams is installed.
But , how it will work for users who have only MSTeams installed and not outlook calendar?

@anikdhabal anikdhabal marked this pull request as draft May 18, 2025 07:06
Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's approach this in a way that doesn't affect active users. There are many users who have already installed and are actively using it. It doesn’t make sense to break it for them and ask them to reinstall. If users are happy with the current setup, we shouldn’t force them to go through that process. So let's find a fix that preserves the existing experience

@vijayraghav-io
Copy link
Contributor Author

vijayraghav-io commented May 18, 2025

To update the progress:

  • Pushed changes without changing scopes.
  • Skipping VideoMeeting Creation by making MSTeams has non-dedicated integration similar to google meet.
  • Updated CreateEvent() and UpdateEvent() in office365calendar/lib/CalendarService to create/update events as 'onlineMeeting' based on the event.location, if MSTeams (i.e. integrations:office365video).

Tested the working with an work account in MSTeams and outlook calendar. Working as expected and as shown in after fix videos. (booking, rescheduling, cancel)

Will update more notes , by testing different scenarios for existing users and existing bookings.
Will do one more round of self-review, before moving it from draft.

For new users - We may have to enforce that MSTeams can be installed only if outlook calendar is installed, similar to how we do for google meet.
And provide a fallback or change location to daily video, if only MSTeams is installed without outlook.
But we will be enforcing this because we are not changing the scope, though MSTeams installation alone can actually create outlook calendar events (with reqd 'Calendars.ReadWrite' scope).

@anikdhabal anikdhabal assigned anikdhabal and unassigned anikdhabal Jun 24, 2025
@github-actions github-actions bot removed the Stale label Jun 25, 2025
@anikdhabal
Copy link
Contributor

anikdhabal commented Jul 1, 2025

@vijayraghav-io is your pr fix this? Because the linked issue started from this and aims to fix the double email sending issue?


1. Install MS Teams app from the app marketplace
2. Setup MS Outlook as your main Calendar
3. Create a Booking and set MS Teams as the meeting software
4. Book a meeting
5. Atendees will receive 2 emails: 1 from Cal.com + 1 from MS Calendar. It's fine and expected that they get two emails.```

@vijayraghav-io
Copy link
Contributor Author

vijayraghav-io commented Jul 1, 2025

@vijayraghav-io is your pr fix this? Because the linked issue started from this and aims to fix the double email sending issue?


1. Install MS Teams app from the app marketplace
2. Setup MS Outlook as your main Calendar
3. Create a Booking and set MS Teams as the meeting software
4. Book a meeting
5. Atendees will receive 2 emails: 1 from Cal.com + 1 from MS Calendar. It's fine and expected that they get two emails.```

@anikdhabal
getting 2 emails is not an issue, also as highlighted here, it is as expected.
Also it is normal with any other calendar apps as well to get 1 email from cal and 1 from calendar app.

Screenshot 2025-07-01 at 1 11 19 PM

So, this PR resolves all other issues mentioned in this issue description #14765, like

  • Event on MS Teams Calendar not created as online meeting
  • The text on this event on MS Teams is not formatted as expected
    ....

Please refer this PR description for more details.

@anikdhabal anikdhabal self-assigned this Jul 14, 2025
@anikdhabal
Copy link
Contributor

@vijayraghav-io The improvement looks good and should work fine for new installations. But how is backward compatibility being handled? I’ve seen that MS Calendar and MS Teams video dependent. Please make sure it doesn’t cause any issues for active MS Teams users. It should seamlessly support full CRUD operations for existing users without any problems

@vijayraghav-io
Copy link
Contributor Author

vijayraghav-io commented Jul 15, 2025

@vijayraghav-io The improvement looks good and should work fine for new installations. But how is backward compatibility being handled? I’ve seen that MS Calendar and MS Teams video dependent. Please make sure it doesn’t cause any issues for active MS Teams users. It should seamlessly support full CRUD operations for existing users without any problems

@anikdhabal Thank you! 🙏.
Yes had thought of backward compatibility while creating PR and was handled.
Please check my latest comments below.

@vijayraghav-io
Copy link
Contributor Author

@vijayraghav-io The improvement looks good and should work fine for new installations. But how is backward compatibility being handled? I’ve seen that MS Calendar and MS Teams video dependent. Please make sure it doesn’t cause any issues for active MS Teams users. It should seamlessly support full CRUD operations for existing users without any problems

@anikdhabal , verified this again.

Scenario - For Users who have only MS Teams installed and no Outlook(or MS) Calendar, after this PR is released :
Create : Cal Video link will be created for the booking as fallback.
Since Outlook calendar is not installed and only MS Teams, cal video link will be created as fallback and not MS Teams meeting link. This is in-line or similar to GoogleMeet & GoogleCalendar implementation.
If we allow to create MS Teams meeting link (without MS Calendar being installed), we again get the same issues reported for which this PR was created (like no online-meeting and not formatted text on MSTeams event)
So User would have to install Outlook Calendar to successfully create MSTeams video meeting with fixes from this PR.
Read : Read operation will not be affected
Users can still use the same MSTeam video meeting links created earlier (i.e. before this PR get merged)
Update: If Users reschedule the MSTeam video meetings (or bookings) created earlier, a new MSTeam video meeting will be created. This is same as earlier flow and so its not affected.
But, the new or rescheduled video meetings will be of same type as earlier (not online-meeting type and not formatted text).
Delete: Not affected, users can cancel the bookings with MSTeams created earlier.

Scenario - For Users who have both MS Teams and Outlook(or MS) Calendar installed, after this PR is released :
Create: Users will have new improved seamless experience with new improved versions.
Update: If Users reschedule the bookings (with Outlook and MSTeams) created earlier, due care is taken to reschedule the Non-Online meeting types created earlier to new improved version.
Kindly refer this my self-review comment - #21377 (comment)
Read: Not affected, bookings created earlier can be used.
Delete: Not affected, bookings created earlier can be deleted or canceled.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

The changes introduce enhanced support for Microsoft Teams (MS Teams) and Office 365 Calendar integration. Key updates include improved handling of online meetings in Office365CalendarService, ensuring that online meeting details and rich HTML descriptions are preserved and correctly formatted. The EventManager now supports fallback logic and updates video call data for MS Teams meetings. New constants and dependency declarations are added for MS Teams integration. Additionally, translation and configuration files are updated to reflect these changes, and a new function for generating rich HTML event descriptions is introduced.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Assessment against linked issues

Objective Addressed Explanation
Proper creation of MS Teams + MS Calendar meetings as online meetings with correct location and format (#14765, CAL-3446)
Ensure online meeting link is handled by Microsoft, not by setting location to the meeting link (#14765)
Improve event description formatting for MS Teams/Outlook calendar invites (#14765)
Add and recognize MS Teams as a valid location/integration throughout the app (#14765, CAL-3446)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9edb0f5 and 8daf047.

📒 Files selected for processing (1)
  • packages/app-store/office365calendar/lib/CalendarService.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/app-store/office365calendar/lib/CalendarService.ts
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (6)
packages/lib/EventManager.ts (2)

289-321: Consider refactoring duplicate fallback logic.

The fallback logic for MSTeams (lines 304-321) is nearly identical to Google Meet (lines 289-303). Consider extracting this into a reusable function to reduce duplication and improve maintainability.

+private shouldFallbackToCalVideo(
+  locationType: string,
+  expectedIntegration: string,
+  mainHostDestinationCalendar: typeof evt.destinationCalendar[0] | undefined,
+  calendarCredentials: CredentialForCalendarService[]
+): boolean {
+  if (mainHostDestinationCalendar?.integration === expectedIntegration) {
+    return false;
+  }
+  
+  const [credential] = calendarCredentials.filter(
+    (cred) => cred.type === expectedIntegration
+  );
+  
+  if (!isDelegationCredential({ credentialId: credential?.id })) {
+    log.warn(
+      `Falling back to Cal Video integration for Regular Credential as ${expectedIntegration} is not set as destination calendar`
+    );
+    return true;
+  }
+  
+  return false;
+}

// Then use it:
-if (evt.location === MeetLocationType && mainHostDestinationCalendar?.integration !== "google_calendar") {
-  const [googleCalendarCredential] = this.calendarCredentials.filter(
-    (cred) => cred.type === "google_calendar"
-  );
-  if (!isDelegationCredential({ credentialId: googleCalendarCredential?.id })) {
-    log.warn(
-      "Falling back to Cal Video integration for Regular Credential as Google Calendar is not set as destination calendar"
-    );
-    evt["location"] = "integrations:daily";
-    evt["conferenceCredentialId"] = undefined;
-  }
-}
+if (evt.location === MeetLocationType && 
+    this.shouldFallbackToCalVideo(evt.location, "google_calendar", mainHostDestinationCalendar, this.calendarCredentials)) {
+  evt["location"] = "integrations:daily";
+  evt["conferenceCredentialId"] = undefined;
+}

// Similar for MSTeams

354-377: LGTM! Correctly extracts Teams meeting URL from calendar event.

This implementation properly handles MSTeams by extracting the meeting URL from the Office365 calendar event instead of creating a separate video meeting. The logic correctly updates both videoCallData and responses location data.

packages/app-store/office365calendar/lib/CalendarService.ts (4)

258-264: LGTM! Correctly extracts Teams meeting URL.

The implementation properly handles the optional onlineMeeting.joinUrl from the Microsoft Graph API response and assigns it to the event URL.


276-285: Consider caching to reduce API calls for MSTeams updates.

While fetching the existing event is necessary to preserve the meeting blob, this adds an extra Graph API call for every MSTeams update operation. Consider implementing a caching mechanism or batching strategy to reduce API calls, especially for bulk operations.


427-444: Well-structured online meeting detection and content generation.

The implementation correctly handles different scenarios for online meetings, preserving existing content for rescheduled meetings and generating rich HTML descriptions. The content type is appropriately set based on meeting type.


500-510: LGTM! Comprehensive online meeting configuration.

The implementation correctly sets all required properties for Teams online meetings and handles backward compatibility for meetings that weren't originally online meetings.

🧹 Nitpick comments (2)
packages/lib/CalEventParser.ts (1)

317-367: Consider HTML sanitization for security.

The function generates HTML content without sanitization. While the input data is typically trusted (coming from CalendarEvent properties), consider adding HTML sanitization as a defensive measure, especially for user-provided content like descriptions and additional notes.

Consider using a library like DOMPurify or similar for HTML sanitization, particularly for user-provided fields:

import DOMPurify from 'dompurify';

// In textToHtml helper:
return `<p>${DOMPurify.sanitize(line)}</p>`;
packages/app-store/office365calendar/lib/CalendarService.ts (1)

436-438: Improve HTML concatenation for better formatting.

The current string concatenation might result in inconsistent spacing. Consider using a more robust approach.

-        content = `
-        ${getRichDescriptionHTML(event)}<hr>
-        ${existingBody}`.trim();
+        content = [getRichDescriptionHTML(event), '<hr>', existingBody]
+          .filter(Boolean)
+          .join('\n')
+          .trim();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2965450 and 2d69e1f.

📒 Files selected for processing (7)
  • packages/app-store/components.tsx (2 hunks)
  • packages/app-store/locations.ts (1 hunks)
  • packages/app-store/office365calendar/lib/CalendarService.ts (5 hunks)
  • packages/app-store/office365video/_metadata.ts (1 hunks)
  • packages/app-store/office365video/config.json (1 hunks)
  • packages/lib/CalEventParser.ts (1 hunks)
  • packages/lib/EventManager.ts (5 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/locations.ts
  • packages/app-store/office365video/_metadata.ts
  • packages/lib/CalEventParser.ts
  • packages/lib/EventManager.ts
  • packages/app-store/office365calendar/lib/CalendarService.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/locations.ts
  • packages/app-store/office365video/_metadata.ts
  • packages/app-store/components.tsx
  • packages/lib/CalEventParser.ts
  • packages/lib/EventManager.ts
  • packages/app-store/office365calendar/lib/CalendarService.ts
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • packages/app-store/components.tsx
**/*Service.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/app-store/office365calendar/lib/CalendarService.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/app-store/office365calendar/api/webhook.ts:120-123
Timestamp: 2025-07-18T17:57:16.395Z
Learning: The office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is specifically designed for Office365 calendar integration, not as a generic webhook handler. Therefore, it's safe to assume that fetchAvailabilityAndSetCache method will be implemented in the Office365CalendarService, making explicit validation checks unnecessary.
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: In Cal.com's calendar integration, both Google Calendar and Outlook Calendar are designed to allow multiple eventTypeIds to share the same subscription ID (googleChannelId or outlookSubscriptionId). This is an intentional design pattern to reuse existing subscriptions for efficiency rather than creating separate subscriptions for each event type. Therefore, unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be added as they would break this subscription sharing functionality.
📚 Learning: the office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is spec...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/app-store/office365calendar/api/webhook.ts:120-123
Timestamp: 2025-07-18T17:57:16.395Z
Learning: The office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is specifically designed for Office365 calendar integration, not as a generic webhook handler. Therefore, it's safe to assume that fetchAvailabilityAndSetCache method will be implemented in the Office365CalendarService, making explicit validation checks unnecessary.

Applied to files:

  • packages/app-store/office365video/_metadata.ts
  • packages/app-store/office365video/config.json
  • packages/lib/EventManager.ts
  • packages/app-store/office365calendar/lib/CalendarService.ts
📚 Learning: cal.com integrations: `webapp_url_for_oauth` intentionally falls back to `http://localhost:3000` whe...
Learnt from: hariombalhara
PR: calcom/cal.com#22840
File: packages/app-store/webex/api/add.ts:4-4
Timestamp: 2025-08-04T13:14:39.218Z
Learning: Cal.com integrations: `WEBAPP_URL_FOR_OAUTH` intentionally falls back to `http://localhost:3000` when neither production nor development, matching the pattern used by other apps in the repo.

Applied to files:

  • packages/app-store/office365video/_metadata.ts
📚 Learning: applies to **/*.tsx : always use `t()` for text localization in frontend code; direct text embedding...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.tsx : Always use `t()` for text localization in frontend code; direct text embedding should trigger a warning

Applied to files:

  • packages/app-store/components.tsx
📚 Learning: when making localization changes for new features, it's often safer to add new strings rather than m...
Learnt from: bandhan-majumder
PR: calcom/cal.com#22359
File: packages/lib/server/locales/en/common.json:1336-1339
Timestamp: 2025-07-14T16:31:45.233Z
Learning: When making localization changes for new features, it's often safer to add new strings rather than modify existing ones to avoid breaking existing functionality that depends on the original strings. This approach allows for feature-specific customization while maintaining backward compatibility.

Applied to files:

  • packages/app-store/components.tsx
📚 Learning: in cal.com's getusereventgroups handler refactor (pr #22618), the membershipcount field for team eve...
Learnt from: sean-brydon
PR: calcom/cal.com#22618
File: packages/trpc/server/routers/viewer/eventTypes/utils/transformUtils.ts:113-113
Timestamp: 2025-08-05T07:42:06.316Z
Learning: In Cal.com's getUserEventGroups handler refactor (PR #22618), the membershipCount field for team event groups is intentionally set to 0 in the new createTeamEventGroup function, as confirmed by sean-brydon (PR author). This preserves the same behavior as the old implementation that was being refactored, maintaining backward compatibility. While other parts of the codebase may use actual member counts, this specific implementation maintains the previous behavior.

Applied to files:

  • packages/lib/EventManager.ts
📚 Learning: the outlook calendar integration in cal.com intentionally reuses subscription ids across multiple ev...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: The Outlook Calendar integration in Cal.com intentionally reuses subscription IDs across multiple event types for efficiency. The `upsertSelectedCalendarsForEventTypeIds` method creates separate SelectedCalendar records for each eventTypeId, all sharing the same outlookSubscriptionId. This subscription sharing pattern means that unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be applied as they would prevent this intended functionality.

Applied to files:

  • packages/lib/EventManager.ts
📚 Learning: in cal.com's calendar integration, both google calendar and outlook calendar are designed to allow m...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: In Cal.com's calendar integration, both Google Calendar and Outlook Calendar are designed to allow multiple eventTypeIds to share the same subscription ID (googleChannelId or outlookSubscriptionId). This is an intentional design pattern to reuse existing subscriptions for efficiency rather than creating separate subscriptions for each event type. Therefore, unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be added as they would break this subscription sharing functionality.

Applied to files:

  • packages/lib/EventManager.ts
📚 Learning: in cal.com's embed system, internal events like "__scrollbydistance" are fired by cal.com's own code...
Learnt from: hariombalhara
PR: calcom/cal.com#22547
File: packages/embeds/embed-core/src/lib/eventHandlers/scrollByDistanceEventHandler.ts:11-14
Timestamp: 2025-07-16T11:46:28.759Z
Learning: In Cal.com's embed system, internal events like "__scrollByDistance" are fired by Cal.com's own code, so runtime validation of event data structure is unnecessary since TypeScript type system guarantees type safety for internal events.

Applied to files:

  • packages/app-store/office365calendar/lib/CalendarService.ts
📚 Learning: applies to **/*.{ts,tsx} : flag excessive day.js use in performance-critical code; prefer native dat...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{ts,tsx} : Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js `.utc()` in hot paths like loops

Applied to files:

  • packages/app-store/office365calendar/lib/CalendarService.ts
🧬 Code Graph Analysis (2)
packages/lib/EventManager.ts (2)
packages/app-store/locations.ts (2)
  • MeetLocationType (62-62)
  • MSTeamsLocationType (64-64)
packages/lib/delegationCredential/clientAndServer.ts (1)
  • isDelegationCredential (11-11)
packages/app-store/office365calendar/lib/CalendarService.ts (2)
packages/app-store/locations.ts (1)
  • MSTeamsLocationType (64-64)
packages/lib/CalEventParser.ts (1)
  • getRichDescriptionHTML (317-367)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (7)
packages/app-store/locations.ts (1)

64-64: LGTM! Clean addition following established patterns.

The new MSTeamsLocationType constant follows the same naming convention and format as existing location type constants like DailyLocationType and MeetLocationType. The value "integrations:office365_video" correctly matches the integration identifier.

packages/app-store/office365video/config.json (1)

25-25: LGTM! Logical dependency declaration.

Adding the office365-calendar dependency is appropriate given that MS Teams meetings now rely on the calendar service to create proper online meetings. This ensures users have the required calendar integration installed before enabling MS Teams functionality.

packages/app-store/office365video/_metadata.ts (1)

24-24: LGTM! Consistent dependency declaration.

The dependency declaration matches the one added to config.json, ensuring consistency between the app's metadata and configuration. This alignment is important for proper dependency resolution during app installation.

packages/app-store/components.tsx (1)

100-100: LGTM! Proper i18next interpolation configuration.

Adding interpolation: { escapeValue: false } follows i18next best practices and addresses the previous review feedback. This ensures that HTML formatting in dependency-related messages is rendered correctly without being escaped.

Also applies to: 119-119

packages/lib/EventManager.ts (2)

10-10: LGTM!

The import correctly adds MSTeamsLocationType alongside the existing MeetLocationType, following the established pattern.


47-49: LGTM!

Correctly excludes MSTeams from dedicated integrations, treating it similarly to Google Meet since both are tied to their respective calendar services.

packages/app-store/office365calendar/lib/CalendarService.ts (1)

4-6: LGTM!

The imports are correctly added for MSTeams location type checking and rich HTML description generation.

Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few tweaks

Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Copy link
Contributor

github-actions bot commented Aug 6, 2025

E2E results are ready!

@anikdhabal anikdhabal requested a review from volnei August 8, 2025 06:36
@hariombalhara hariombalhara merged commit 242f868 into calcom:main Aug 11, 2025
55 of 61 checks passed
@vijayraghav-io
Copy link
Contributor Author

Thank you! 🙏

@coderabbitai coderabbitai bot mentioned this pull request Aug 12, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar 🙋 Bounty claim 💎 Bounty A bounty on Algora.io 🐛 bug Something isn't working calendar-apps area: calendar, google calendar, outlook, lark, microsoft 365, apple calendar community Created by Linear-GitHub Sync emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email High priority Created by Linear-GitHub Sync 🧹 Improvements Improvements to existing features. Mostly UX/UI Medium priority Created by Linear-GitHub Sync ready-for-e2e $500
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] MS Teams + MS Calendar Bad Implementation
5 participants