1

Is there a way to obtain a (unique) inbox id by the mail item, maybe over one of the mailitem properties:

https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem_properties.aspx

I have in my Outlook 2010 a mail that was moved in the deleted items folder. Now I am looking for the source where did it come from (my private inbox or the shared inbox).

creg
  • 154
  • 3
  • 13

2 Answers2

1

When an items is moved to a different folder, it retains no knowledge about its previous parent. Foo all practical purposes, it is a completely new item.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • @Dimitri: thank you for your explanation, but is there a way to store i.e. a user property with the origin postbox id inside the mailitem, permanently and before the mailitem has been (completely) moved. I think about an Event, that is firing before the ItemAdd-Event fires. – creg Jan 21 '16 at 10:52
  • In theory, you can use the MAPIFolder.BeforeItemMove event - set up an event handler on Application.ActiveExplorer and trap the Explorer.FolderSwitch event (there can be more than one explorer object open), then use Explorer.ActiveFolder object and set up the MAPIFolder.BeforeItemMove event handler. In practice however, BeforeItemMove is not very reliable and does nto always fire. – Dmitry Streblechenko Jan 21 '16 at 12:40
0

I want to provide you my solution for solve this problem. In this case you can subscribe to event "BeforeItemMove" of folder and when event occured you need check a folder name. If folder name is "Delted Items" you can write information about your inbox (private or shared) in "UserProperties" of mail item. In addition to that you need subscribe to event "ItemAdd" of delete folder. As a result you will receive information about your inbox.

Aliaksei Futryn
  • 461
  • 5
  • 8