Unknown Outlook MailItem EntryID

  • Thread starter Nenad Dobrilovic
  • Start date
N

Nenad Dobrilovic

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?
 
K

Ken Slovak - [MVP - Outlook]

Does this involve Exchange server?

Exchange related stores (mailboxes and public folders) can supply 2 types of
EntryID to you, short-term and long-term. The long-term id is permanent as
long as the item is in the same store and folder, the short-term id is valid
only for that Outlook session.

When Outlook or another API compares 2 EntryID values using the MAPI
CompareIDs method it accounts for both types of EntryID, so the comparison
works even if short and long term id's are being compared. That won't work
using a simple equality comparison.

In MAPI terms if you get a MAPITable object of a folder's Items collection
you can request both the short and long-term ids. If you get a null or empty
value for the long-term id you then grab the short-term id.

Again in MAPI terms, the property tag for the short-term id is PR_ENTRYID =
0x0FFF0102 and for the long-term id is PR_LONGTERM_ENTRYID_FROM_TABLE =
0x66700102.

If you are using the Outlook object model then any methods that take the
EntryID, such as NameSpace.GetItemFromID() will accept either of those id
values and treat them as the same, and will return the same item no matter
which id is used in the method call.
 
N

Nenad Dobrilovic

Thank you for the detailed answer.

I didn't give you all relevant information, sorry. Exchange Server was
involved, and MailItem was saved after creating and moved to the external pst
file later.

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.
 
K

Ken Slovak - [MVP - Outlook]

Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.
 
S

Silas Peterson

Would CompareIDs work when comparing old ID (when the item was in another store) with new ID (when item is moved to a different store)?



Ken Slovak - [MVP - Outlook] wrote:

Don't forget that EntryID will change when an item is moved from one store to
03-Oct-08

Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.




message
Previous Posts In This Thread:

Unknown Outlook MailItem EntryID
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?
--
Nenad Dobrilovic

Does this involve Exchange server?
Does this involve Exchange server?

Exchange related stores (mailboxes and public folders) can supply 2 types of
EntryID to you, short-term and long-term. The long-term id is permanent as
long as the item is in the same store and folder, the short-term id is valid
only for that Outlook session.

When Outlook or another API compares 2 EntryID values using the MAPI
CompareIDs method it accounts for both types of EntryID, so the comparison
works even if short and long term id's are being compared. That won't work
using a simple equality comparison.

In MAPI terms if you get a MAPITable object of a folder's Items collection
you can request both the short and long-term ids. If you get a null or empty
value for the long-term id you then grab the short-term id.

Again in MAPI terms, the property tag for the short-term id is PR_ENTRYID =
0x0FFF0102 and for the long-term id is PR_LONGTERM_ENTRYID_FROM_TABLE =
0x66700102.

If you are using the Outlook object model then any methods that take the
EntryID, such as NameSpace.GetItemFromID() will accept either of those id
values and treat them as the same, and will return the same item no matter
which id is used in the method call.




message
Thank you for the detailed answer.
Thank you for the detailed answer.

I didn't give you all relevant information, sorry. Exchange Server was
involved, and MailItem was saved after creating and moved to the external pst
file later.

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 Dobrilovic


:

Don't forget that EntryID will change when an item is moved from one store to
Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.




message

Submitted via EggHeadCafe - Software Developer Portal of Choice
Putting Twitter Realtime Search to Work
http://www.eggheadcafe.com/tutorial...24-c9960b55b669/putting-twitter-realtime.aspx
 
S

Silas Peterson

Would CompareIDs work when comparing old ID (when the item was in another store) with new ID (when item is moved to a different store)?



Ken Slovak - [MVP - Outlook] wrote:

Don't forget that EntryID will change when an item is moved from one store to
03-Oct-08

Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.




message
Previous Posts In This Thread:

Unknown Outlook MailItem EntryID
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?
--
Nenad Dobrilovic

Does this involve Exchange server?
Does this involve Exchange server?

Exchange related stores (mailboxes and public folders) can supply 2 types of
EntryID to you, short-term and long-term. The long-term id is permanent as
long as the item is in the same store and folder, the short-term id is valid
only for that Outlook session.

When Outlook or another API compares 2 EntryID values using the MAPI
CompareIDs method it accounts for both types of EntryID, so the comparison
works even if short and long term id's are being compared. That won't work
using a simple equality comparison.

In MAPI terms if you get a MAPITable object of a folder's Items collection
you can request both the short and long-term ids. If you get a null or empty
value for the long-term id you then grab the short-term id.

Again in MAPI terms, the property tag for the short-term id is PR_ENTRYID =
0x0FFF0102 and for the long-term id is PR_LONGTERM_ENTRYID_FROM_TABLE =
0x66700102.

If you are using the Outlook object model then any methods that take the
EntryID, such as NameSpace.GetItemFromID() will accept either of those id
values and treat them as the same, and will return the same item no matter
which id is used in the method call.




message
Thank you for the detailed answer.
Thank you for the detailed answer.

I didn't give you all relevant information, sorry. Exchange Server was
involved, and MailItem was saved after creating and moved to the external pst
file later.

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 Dobrilovic


:

Don't forget that EntryID will change when an item is moved from one store to
Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.




message
CompareIDs
Would CompareIDs work when comparing old ID (when the item was in another store) with new ID (when item is moved to a different store)?


Submitted via EggHeadCafe - Software Developer Portal of Choice
Generic Feed Parsers Redux
http://www.eggheadcafe.com/tutorial...6-acd41f462063/generic-feed-parsers-redu.aspx
 
K

Ken Slovak - [MVP - Outlook]

Yes.




Would CompareIDs work when comparing old ID (when the item was in another
store) with new ID (when item is moved to a different store)?



Ken Slovak - [MVP - Outlook] wrote:

Don't forget that EntryID will change when an item is moved from one store
to
03-Oct-08

Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.




message
Previous Posts In This Thread:

Unknown Outlook MailItem EntryID
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?
--
Nenad Dobrilovic

Does this involve Exchange server?
Does this involve Exchange server?

Exchange related stores (mailboxes and public folders) can supply 2 types
of
EntryID to you, short-term and long-term. The long-term id is permanent as
long as the item is in the same store and folder, the short-term id is
valid
only for that Outlook session.

When Outlook or another API compares 2 EntryID values using the MAPI
CompareIDs method it accounts for both types of EntryID, so the comparison
works even if short and long term id's are being compared. That won't work
using a simple equality comparison.

In MAPI terms if you get a MAPITable object of a folder's Items collection
you can request both the short and long-term ids. If you get a null or
empty
value for the long-term id you then grab the short-term id.

Again in MAPI terms, the property tag for the short-term id is PR_ENTRYID
=
0x0FFF0102 and for the long-term id is PR_LONGTERM_ENTRYID_FROM_TABLE =
0x66700102.

If you are using the Outlook object model then any methods that take the
EntryID, such as NameSpace.GetItemFromID() will accept either of those id
values and treat them as the same, and will return the same item no matter
which id is used in the method call.




message
Thank you for the detailed answer.
Thank you for the detailed answer.

I didn't give you all relevant information, sorry. Exchange Server was
involved, and MailItem was saved after creating and moved to the external
pst
file later.

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 Dobrilovic


:

Don't forget that EntryID will change when an item is moved from one store
to
Don't forget that EntryID will change when an item is moved from one store
to another (mailbox to PST for example).

If you were using a lower level API such as Extended MAPI, CDO 1.21 or
Redemption (www.dimastr.com/redemption) you could use the CompareIDs()
method to compare a short-term id with a long-term one and get equality if
they reference the same item.




message

Submitted via EggHeadCafe - Software Developer Portal of Choice
Putting Twitter Realtime Search to Work
http://www.eggheadcafe.com/tutorial...24-c9960b55b669/putting-twitter-realtime.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top