Share via

How to restore a Deleted Event Using Graph API

Henry John 0 Reputation points
2026-03-24T01:18:36.8466667+00:00

Context

We are currently migrating functionality from EWS to Microsoft Graph API (Java). We have a requirement to delete and then programmatically restore calendar events. While our EWS implementation works perfectly, we are struggling to locate the deleted events using the Graph API.

Current EWS Implementation (Working)

In EWS, we use DeleteMode.HardDelete and then search the RecoverableItemsPurges folder to move the item back to the Calendar.


// How we delete meeting from calendar
if (msg instanceof MeetingMessage) {
    MeetingMessage meetingMessage = MeetingMessage.bind(service, msg.getId());
    ItemId masterId = meetingMessage.getAssociatedAppointmentId();
    if (masterId != null) {
        Appointment appointment = Appointment.bind(service, masterId);
        appointment.delete(DeleteMode.HardDelete);
    }
}
// How we restore the message
ItemView itemView = new ItemView(EwsServer.FOLDER_VIEW_PAGE_SIZE);
itemView.setTraversal(ItemTraversal.Shallow);
SearchFilter filterColl = new SearchFilter.SearchFilterCollection(
    LogicalOperator.And, 
    new SearchFilter.IsEqualTo(ItemSchema.Subject, message.getSubject()),
    new SearchFilter.IsEqualTo(EmailMessageSchema.Sender, message.getSender().getAddress())
);
FindItemsResults<Item> deletedItems = server.getExchangeService()
    .findItems(WellKnownFolderName.RecoverableItemsPurges, filterColl, itemView);
if (deletedItems.getItems().size() > 0) {
    for (Item item : deletedItems.getItems()) {
        item.move(WellKnownFolderName.Calendar);
        break;
    }
}

Problem: Graph API Implementation (Not Working)

When using the Graph SDK, we cannot find the event in the recoverable items folders after a deletion.

Deletion code:

Java

graphClient
.users().byUserId(mailboxBeingScanned) 
    .calendar().events().byEventId(eventId)     
.permanentDelete().post();  // used delete() method as well 

//OR we have tried this as well 

graphClient.users().byUserId(mailboxBeingScanned)   
  .calendar().events().byEventId(eventId)    
 .delete(); 

Attempted recovery code: We have tried searching recoverableitemspurges, deleteditems, and recoverableitemsdeletions using the internetMessageId, but the collection always returns empty.

Java

MessageCollectionResponse eventMessage = graphClient.users().byUserId(mailboxBeingScanned)
    .mailFolders().byMailFolderId(

Questions

When using permanentDelete() on a Calendar Event in Graph, does it land in a different folder than it would via EWS?

  1. What is the correct mailFolderId or endpoint to query for items in the "Recoverable Items" partition specifically for Calendar events?
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

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.