Skip to content
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

Teams Recurring Meeting Update Issue with Graph API #1857

Open
Thesiva7 opened this issue Dec 31, 2024 · 0 comments
Open

Teams Recurring Meeting Update Issue with Graph API #1857

Thesiva7 opened this issue Dec 31, 2024 · 0 comments
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned

Comments

@Thesiva7
Copy link

Thesiva7 commented Dec 31, 2024

I successfully created a recurring Teams meeting using the Graph API.
After that, I updated the entire recurring series using the Graph API, which worked successfully.
I then tried updating a single instance of the recurring series using the Graph API, and that also succeeded.

However, once I update any single instance of the recurring series, any subsequent attempt to update the entire recurring series results in a 500 Internal Server Error from the Graph API.

Below is the code snippet I’m using to update the meeting in Node.js:

process.env.teamsScheduleMeeting = "https://graph.microsoft.com/v1.0/me/events"

const headers = {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json',
    'Prefer': `outlook.timezone="${payload?.timezone ? payload?.timezone : payload.booking.timezone}", outlook.body-content-type="text"`
};

const meetingData = {
    ...(payload?.title && { subject: payload?.title }),
    ...(payload?.startTime && payload?.endTime && payload?.timezone && {
        start: {
            dateTime: new Date(Number(payload?.startTime)).toISOString(),
            timeZone: payload?.timezone
        },
        end: {
            dateTime: new Date(Number(payload?.endTime)).toISOString(),
            timeZone: payload?.timezone
        }
    }),
    ...(payload?.recurrence && { recurrence: payload.recurrence }),
    ...(payload?.participants && Array.isArray(payload?.participants) && {
        attendees: payload.participants.map(email => ({ emailAddress: { address: email } }))
    })
};

const teamsMeetingUpdateUrl = `${process.env.teamsScheduleMeeting}/${payload.type === "recurringInstance" ? payload.instanceId : payload.eventId}`;

const existingEventDetails = await axios.get(teamsMeetingUpdateUrl, { headers });
const existingContent = existingEventDetails?.data?.body?.content;

if (payload?.description) {
    // Update the body content only if a new description is provided
    meetingData.body = {
        contentType: 'text', // Retain original or default to text
        content: existingContent.replace(/^(.*?)(\r\n|$)/, `${payload.description}$2`) // Replace first line with the new description
    };
}

const updateEvent = await axios.patch(teamsMeetingUpdateUrl, meetingData, { headers });
console.log('updateEvent---', updateEvent);

Can some one help me understand why the Graph API fails with a 500 error when updating the entire series after modifying a single instance?

@Thesiva7 Thesiva7 added the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned
Projects
None yet
Development

No branches or pull requests

1 participant