views:

1242

answers:

2

My Outlook add-in handles NewInspector event of the Inspector object, in order to display a custom form for the mail item.

I can get EntryID of the CurrentItem of the Inspector object which is passed as a parameter of the event. But, the problem is that the EntryID of the current mail item is shorter than it should be, and is unknown. I know every EntryID of every mail item that was created, and I can see that specific mail item has a wrong EntryID.

What is wrong?

A: 

It could be anything - from bug in Outlook or your interop assembly, to corrupted pst file.

I would try to find if the item belongs to the right store, and also to try a search for this message by EntryID. If the search fails, than most probably something is wrong with the message store itself.

EDIT: per your additional comment: This explains what was wrong :)

One suggestion though - why not use custom category to tag "your" items - easier to find, and no need to store a list.

Sunny
+1  A: 

The idea is to remember every EntryID of the MailItem that was created by an add-in, so that it can be treated differently later. Problem was that EntryID of the item opened by an Inspector was the short one, and not in the list of remembered ids, although it should be.

Few lines of code where I was creating mail item were:

item.Save();
item.Move(some_folder);
items_list.Add(item.EntryID);

Folder 'some_folder' is inside of external non-default PST, so mail item gets new EntryID. I changed those lines to:

item.Save();
item = (Outlook.MailItem)item.Move(some_folder);
items_list.Add(item.EntryID);

Now, item has a new EntryID, which can be found later.

Nenad
If you are doing a save you can always just mark the mailItem with a userProperty and then search for that later. Alot of people use the mileage/billing fields for this kind of thing but obviously if you have other addin's you could clash! So userProperties tend to be better bet.
76mel