CompareIDs

Status
Not open for further replies.
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)?
- 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.

"Nenad Dobrilovic" <NenadDobrilovic> wrote in

message news:CF4BF5F3-7496-4EF3-969F-5E499A7DD4BD@microsoft.com...

Previous Posts In This Thread:

On Thursday, October 02, 2008 8:43 AM

NenadDobrilovi wrote:

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

On Thursday, October 02, 2008 9:20 AM
- wrote:

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.

"Nenad Dobrilovic" <NenadDobrilovic> wrote in

message news:DE313809-3856-48B6-AFDA-31A454631E85@microsoft.com...

On Thursday, October 02, 2008 10:25 AM

NenadDobrilovi wrote:

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
wrote:

On Friday, October 03, 2008 8:52 AM
- wrote:

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.

"Nenad Dobrilovic" <NenadDobrilovic> wrote in

message news:CF4BF5F3-7496-4EF3-969F-5E499A7DD4BD@microsoft.com...

Putting Twitter Realtime Search to Work

http://www.eggheadcafe.com/tutorial...24-c9960b55b669/putting-twitter-realtime.aspx
 
Yes.

<Silas Peterson> wrote in message news:201021016180silaspeter@gmail.com...
> 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)?

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

> >

>

> "Nenad Dobrilovic" <NenadDobrilovic> wrote in
> message news:CF4BF5F3-7496-4EF3-969F-5E499A7DD4BD@microsoft.com...

> Previous Posts In This Thread:

> On Thursday, October 02, 2008 8:43 AM
> NenadDobrilovi wrote:

> 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

> On Thursday, October 02, 2008 9:20 AM
> - wrote:

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

> >

>

> "Nenad Dobrilovic" <NenadDobrilovic> wrote in
> message news:DE313809-3856-48B6-AFDA-31A454631E85@microsoft.com...

> On Thursday, October 02, 2008 10:25 AM
> NenadDobrilovi wrote:

> 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

> " - " wrote:

> On Friday, October 03, 2008 8:52 AM
> - wrote:

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

> >

>

> "Nenad Dobrilovic" <NenadDobrilovic> wrote in
> message news:CF4BF5F3-7496-4EF3-969F-5E499A7DD4BD@microsoft.com...

> Putting Twitter Realtime Search to Work
> http://www.eggheadcafe.com/tutorial...24-c9960b55b669/putting-twitter-realtime.aspx
 
Status
Not open for further replies.
Back
Top