StoreID and EntryID

M

Michele

Since I need to insert hyperlinks in Outllok/Exchange items bodies that
points to other Outlook/exchange items using the Outlook url protocol
“Outlook:entryid†I need to change the addresses of the Hyperlinks so that,
if the entryids of the pointed outlook items change, the addresses of the
hyperlinks are updated consequently, and in order to do that I need to know
in which circumstances the entryid property of the Outlook items can change.
I know that the entryid of the Outlook items surely changes if an exchange
item is moved in another folder while for .pst file store provider it surely
changes when it is moved in another .pst file.
But I think I cannot be sure that the entryids of the Outlook/Exchange items
remain constant if they remain in the same folder at least not if they are
accessed in different ways and from different machines/users, I explain why I
think so: I think, but I am not sure and I wish to be corrected if I am
wrong, that the entryids keys are derived keys from other keys and in
particular for exchange store provider the entryid of an item(not a folder)
is derived from the entryid of the folder that contains that item and for
..pst store provider the entryid of an item(folder too) is derived from the
Storeid of the store that contains that item. In exchange store provider the
entryid key of a folder I think is derived from the Storeid of the store
provider. I say so because, since the storeid of a store provider is said to
be unique inside a user profile consequently all the derived keys from it
will be unique among the different store providers that is It cannot happen
that two items(folder too) in different store provider have the same entryid,
so the Outlook url protocol “Outlook:entryid†is always resolved uniquely.
The storeid is said to be unique inside a user profile but not to be
constant among different users/machines so ,if my above reasoning is true, if
a storeid of a .pst file or a storeid of an exchange provider can be
different when accessed by different users/machines also the entryid of the
items (folders too) that are derived from the storeid keys can be different.
Am I correct and if I am correct how can I use an absolute reference to
open/instantiate an exchange/outlook item (folder too) that is valid always
no matter which user and how the user accesses to the .pst file or exchange
server, given that the item doesn’t change its location(folder)?
Thanks a lot for reading me and correct me/help me.
Best regards.
 
D

Dmitry Streblechenko

If the item is not moved or recreated (as is the cases with appointments),
the entry id will staty the same as long as you are using the same profile.
An Outlook item can have a different enrty id depending on how it is being
accessed: e.g. the entry id of an item beign accessed through teh primary
EXchange mailbox in teh profile will be different if the same item is
accessed through a delegate store.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
M

Michele

Thanks a lot Dmitry.
Let’s say I format my pc or I format the exchange server and before
formatting I make a backup of the .pst file or the database files of exchange
server, when I make a new profile using the backup files will the store files
retain the exact items entryid they had before formatting or will they be
different, do I have to make a backup of the profile too other than the
database/.pst files in order to retain the exact same entryids of the items?
In other words what I want to know is where storeid keys and entryid keys
are stored, I mean I don’t think they are stored inside the .pst file or in
the exchange database files, I think they are stored somewhere in the user
profiles, am I correct?
Thanks a lot
 
D

Dmitry Streblechenko

No, that will be fine. As long as the PST file location stays the same, the
store id will remain the same (since it embeds the full path to the PST
file).
As for the Exchange mailbox, the entry id will essentially be a prefix
(specific to the primary mailbox store MAPI provider) and the source keys of
the message and its parent folder, so that too will stay the same.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
M

Michele

Thanks Dmitry for your patience.
I made some tests on entryid and storeid and i saw that what you wrote is
true, that is the storeid remains exactly the same because as you said it is
an hash of the path of .pst file and of its name too so storeid changes only
if you rename the .pst file and/or you move the .pst file in another path of
the system.
With my surprise i discovered that when storeid is changed because you
rename a .pst file or you move it on another system folder the entryids of
the items inside it are not changed as i wrongly supposed in my first post, i
thought that entryids were in some way related to the storeid of the store
container but apparently it isn't so.
I made a test: i created a .pst file for testing purpose and i created in it
a contact and saved in its body its entryid. After that i closed that store
from my profile. Than i went in explorer and copied the .pst testing file in
another path of the system, i opened this copied .pst file in outlook and i
checked if the contact in it had always the same entryid and yes it had the
same entryid and a different storeid (correct because the .pst file had a
different path). After that, without closing the copied .pst file, i opened
in outlook also the original testing .pst file, checked the contact entryid
in it and it was changed in one new, this because i think there cannot be two
identical entryids even if the items are in different .pst files.
In my test the two entryids of the contacts were the same because the .pst
files were identical, copied by me, but this leads me to a question: How can
it be guaranteed that two items in different stores have different entryids
if they are apparently not related to the container storeid, that is if they
are apparently totally randomly generated or putting it in a different way
how can i be sure that an entryid of an item of a .pst file will not be
changed in some new because an exactly identical entryid exists in another
..pst file like in my above example?
Thanks a lot Dmitry.
 
M

Michele

Thanks Dmitry for your patience.
I made some tests on entryid and storeid and i saw that what you wrote is
true, that is the storeid remains exactly the same because as you said it is
an hash of the path of .pst file and of its name too so storeid changes only
if you rename the .pst file and/or you move the .pst file in another path of
the system.
With my surprise i discovered that when storeid is changed because you
rename a .pst file or you move it on another system folder the entryids of
the items inside it are not changed as i wrongly supposed in my first post, i
thought that entryids were in some way related to the storeid of the store
container but apparently it isn't so.
I made a test: i created a .pst file for testing purpose and i created in it
a contact and saved in its body its entryid. After that i closed that store
from my profile. Than i went in explorer and copied the .pst testing file in
another path of the system, i opened this copied .pst file in outlook and i
checked if the contact in it had always the same entryid and yes it had the
same entryid and a different storeid (correct because the .pst file had a
different path). After that, without closing the copied .pst file, i opened
in outlook also the original testing .pst file, checked the contact entryid
in it and it was changed in one new, this because i think there cannot be two
identical entryids even if the items are in different .pst files.
In my test the two entryids of the contacts were the same because the .pst
files were identical, copied by me, but this leads me to a question: How can
it be guaranteed that two items in different stores have different entryids
if they are apparently not related to the container storeid, that is if they
are apparently totally randomly generated or putting it in a different way
how can i be sure that an entryid of an item of a .pst file will not be
changed in some new because an exactly identical entryid exists in another
..pst file like in my above example?
Thanks a lot Dmitry.
 
D

Dmitry Streblechenko

If you simply duplicate a PST file, the me4ssage entry ids will be the same
sine you are not chnaging the contentsof the PST file, only its location.
That is why you should always use both the store and entry id when calling
Namespace.GetItermFromID.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
M

Michele

Thanks Dmitry, your help is really appreciated.
May i ask you one last thing?
Other than in my case that is when someone copy a .pst file, can it be
possible that two items of two different .pst files have the same entryid,
that is are entryid unique in the entire world?
Really thank you.
 
D

Dmitry Streblechenko

Theoretically possible, but not likely - the entry id prefix (muid) is
randonly generated is is specific to a particular PST.
Given that muid is a 16 byte number (GUID) the chances are extremely
unlikely.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
M

Michele

Thank you Dmitry.
So if an Outlook based program has to deal with multiple .pst files even if
it is higly unlikely it has to take in its possibilities that an entryid of
an item could theoretically change if another item with the same entryid was
yet in memory.
I would have made the entryid unique in the world, thing that is not so
complicate or computationally hard to achieve.
It would have been enough to codify the entryid as ashes of both the unique
hardware id of the pc where the store provider is genereated and the exact
timing of its creation, in this way, other than copying the same .pst file,
there wouldn't be any possibility to have in the world two identical entryids.
Thanks a lot Dmitry
Best regards
 
D

Dmitry Streblechenko

This is simply not possible, even theoretically - if the (supposedly) unique
number is 16 bytes long, there is a 1 / 2^128 probability that you will end
up with the same value no matter what kind of algorithm you are using.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
M

Michele

Sure Dmitry, i obviously agree with you.
I was talking about completely revising the structure of the entryid key
making it unique in the entire world.
Ciao
 
M

Michele

Excuse me Dmitry.
I realize now that no finite key can have the 100% of possibility to be
unique in the world no matter the algorithm that generates it exactly as you
wrote.
The only way to have a real unique key is to have a centralized database in
the world that is responsible to distribute the keys but that wouldn't have
sense in Outlook items.
Thanks a lot
 

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