我想恢复我们使用Microsoft graph api删除的邮件。
我找不到任何可以使用api恢复或删除已删除邮件的api。
答案 0 :(得分:1)
Graph API中没有还原方法(MAPI或EWS中也没有还原方法)。当某个项目在Exchange中被删除时,它只是被移到邮箱中的另一个文件夹中,直到该项目的保留期到期为止,然后MFA(托管文件夹助手)将删除该项目。
例如,要恢复垃圾箱中的某个项目,您需要像这样在垃圾箱中查询该项目
https://graph.microsoft.com/v1.0/users('user@mailbox.com')/MailFolders/recoverableitemsDeletions/messages/
然后您可以使用https://docs.microsoft.com/en-us/graph/api/message-move?view=graph-rest-1.0&tabs=http
将其移回到所需的文件夹中如果要将其移回原来的位置,则需要使用LAPFID(最后活动父FolderId)属性https://blogs.technet.microsoft.com/exchange/2017/06/13/announcing-original-folder-item-recovery/。例如,将其用于垃圾箱中的物品上
https://graph.microsoft.com/v1.0/users('user@mailbox.com')/MailFolders/recoverableitemsDeletions/messages/?$select=Subject&$Top=10&$expand=SingleValueExtendedProperties($filter%3DId%20eq%20'Binary%200x348A')
使用LAPFID有点棘手,因为它只是一个不完整的folderId,因此您需要额外的代码,在https://gsexdev.blogspot.com/2018/10/using-lapfid-last-active-parent.html中有一些使用它的示例