microsoftgraph / microsoftgraph/msgraph-sdk-java

How to restore a Deleted Calendar Event Using Graph API

Abierto
#2,561 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

status:waiting-for-triage
Lenguaje dominante
Java
Estrellas
444
Forks
154
Merge medio
18 h 28 min
PR fusionados (30 d)
4

Descripción

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?

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con las llamadas de eliminación de Graph SDK Java y la consulta de recuperación de mailFolders/messages que se muestra en el issue. Determina si permanentDelete() y delete() colocan los eventos de calendario en ubicaciones diferentes, identifica el endpoint o el ID de carpeta correctos de Recoverable Items y verifica que el evento se pueda encontrar para restaurarlo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
api
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.