How can I set up the MS Graph API to purge malicious invites from users' calendars?

Demetry, Dan 0 Reputation points
2026-02-11T00:32:28.5666667+00:00

How can I set up the MS Graph API to purge malicious invites from users' calendars?

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-02-11T00:32:35.48+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To purge malicious invites from users' calendars using the Microsoft Graph API, you can utilize the permanentDelete method for calendar events. This method allows you to permanently delete a calendar folder and the events it contains, effectively removing any unwanted or malicious invites.

    Here’s a general approach to set this up:

    1. Identify the User and Calendar: You need to know the user’s ID or userPrincipalName and the calendar ID from which you want to delete events.
    2. Use the Permanent Delete API: Make a POST request to the endpoint /users/{id | userPrincipalName}/calendar/{calendarId}/permanentDelete to delete the specific calendar or events.
    3. Authentication: Ensure you have the appropriate permissions set up, such as Calendars.ReadWrite, to perform this action.

    Example Request

    POST https://graph.microsoft.com/v1.0/users/{user-id}/calendar/{calendar-id}/permanentDelete
    

    Permissions

    You will need to ensure that your application has the necessary permissions to delete calendar events. The least privileged permission for this API is Calendars.ReadWrite.

    By implementing this API call, you can automate the process of purging malicious invites from users' calendars as part of your security measures.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.