Fix: MS Teams + MS Calendar Bad Implementation
This PR fixes issue #14765 - MS Teams + MS Calendar Bad Implementation.
/claim #14765
Problem
Microsoft Teams meetings created through Cal.com were not being properly integrated with Microsoft Outlook Calendar. Specifically:
- Calendar invites were not properly formatted as Teams meetings
- The Teams meeting link was just added as text in the description or location
- This resulted in unprofessional-looking invitations and poor user experience
- Attendees received two separate emails (one from Cal.com and one from MS Calendar)
Solution
The fix involves two key changes:
-
In office365video/lib/VideoApiAdapter.ts:
- Improved the
createMeeting method to properly format Teams meeting data
- Fixed the
oAuthManagerHelper usage to properly handle it as an object rather than a function
- Added additional metadata to help with calendar integration
- Removed unnecessary console.log statements
- Added better error handling
-
In office365calendar/lib/CalendarService.ts:
- Modified the
translateEvent method to properly set Microsoft Graph API properties for Teams meetings:
- Added
isOnlineMeeting: true
- Set
onlineMeetingProvider: \"teamsForBusiness\"
- Added
onlineMeeting: { joinUrl: event.videoCallData.url }
- Properly formatted the location as a virtual Teams meeting
Testing
I’ve tested this fix with both personal and work Microsoft accounts. The calendar invites now:
- Show properly as Teams meetings in Outlook
- Have the Teams meeting join button directly in the calendar event
- Look professional and consistent with native Teams meeting invites
- Match the expected behavior shown in the issue screenshots
References
This implementation follows Microsoft’s best practices for creating online meetings via the Graph API:
Summary by mrge
Fixed Microsoft Teams meetings so they are now properly integrated with Microsoft Outlook Calendar events. Teams meeting links are now added as true online meetings, making invites look professional and ensuring attendees get a single, correct calendar invite.
- Bug Fixes
- Teams meeting links are now set using Microsoft Graph API properties (
isOnlineMeeting, onlineMeetingProvider, and onlineMeeting).
- Fixed OAuth handling and removed unnecessary code to prevent integration errors.
- Improved error handling and removed duplicate or unneeded emails for attendees.