Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

How to restore a Deleted Calendar Event Using Graph API

オープン
#2,561 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java
領域
api

調査の方向性

Graph SDK Java の削除呼び出しと、issue に示されている mailFolders/messages の復元クエリから始めます。permanentDelete() と delete() が予定表イベントを異なる場所に配置するかどうかを確認し、正しい Recoverable Items エンドポイントまたはフォルダー ID を特定し、復元対象のイベントが見つかることを検証します。

索引モデルが issue の本文から書いたものです。

説明

status:waiting-for-triage

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:

graphClient.users().byUserId(mailboxBeingScanned)
    .calendar().events().byEventId(eventId)
    .permanentDelete().post();
//we have tried delete method as 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.

MessageCollectionResponse eventMessage = graphClient.users().byUserId(mailboxBeingScanned)
    .mailFolders().byMailFolderId("recoverableitemspurges")
    .messages()
    .get(requestConfiguration -> {
        requestConfiguration.queryParameters.filter = "internetMessageId eq '<MN2PR13...prod.outlook.com>'";
    });

Questions

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

  2. What is the correct mailFolderId or endpoint to query for items in the "Recoverable Items" partition specifically for Calendar events?

主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
4

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoftgraph/msgraph-sdk-java のほかの issue

microsoftgraph/msgraph-sdk-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。