0

I have implemeted a feature that filters emails and moves the emails that meet a certain criteria to a "Quarantine" folder where they will be reviewed and if they are deemed safe, they will be restored in the original folder.

The problem i have is that in the quarantine folder i will probably have emails from a lot of different folders, not just Inbox.

Is there a way to find out in what folder was the email originally stored so it can go back upon restoring?

I will also point out that upon moving/copying an email, a new Item is created in the destination folder with a new ItemId.

I am using EWS Managed API (.NET Framework) in Exchange(on-premise) 2019.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
yoxhall
  • 66
  • 1
  • 7

1 Answers1

1

If the folder is in the same mailbox the the LastActiveParentEntryID https://techcommunity.microsoft.com/t5/exchange-team-blog/announcing-original-folder-item-recovery/ba-p/606833 should be able to be used to find the folder it was moved from eg https://gsexdev.blogspot.com/2018/10/using-lapfid-last-active-parent.html

Glen Scales
  • 20,495
  • 1
  • 20
  • 23
  • I found this on Microsoft tech comunity: "When an item is deleted (soft-delete or hard-delete) it is stamped with the LastActiveParentEntryID (LAPEID) MAPI property (property ID 348A). By using the folder ID, it does not matter if the folder is moved in the mailbox’s hierarchy or renamed." Does this apply only to deleted items and **NOT** moved items? – yoxhall Oct 27 '22 at 07:56
  • 1
    If a folder is moved it will get a new Folderid so the LAPEID would then be invalid, if the folder was renamed that doesn't affect the FolderId – Glen Scales Oct 27 '22 at 20:50
  • What about emails. Only emails that get deleted will get a LAPEID? What about the ones that just get moved to another folder? Will they get this extended property? (I tested it and i can't seem to be able to get the LAPEID extended property for moved emails). – yoxhall Oct 28 '22 at 07:19