Working with EntryIDs and StoreIDs
Outlook Developer Reference |
This topic describes using the Entry ID of an item and Store ID of a store to access a specific item in a NameSpace.
If you’re creating a more complex solution using Microsoft Outlook that involves linking or cross-referencing items in folders, one option is to use the MAPI-based identifiers (IDs) of each item. If you know the IDs of an item and the folder it's stored in, you can directly reference the item using the NameSpace.GetItemFromID method.
Each Outlook item has a field called EntryID, which is a unique ID field generated by the messaging storage system for use with the MAPI folders that store the item. It’s important to note that whenever an item is created in a folder, it is assigned a new EntryID. This means that the EntryID field changes if an item is moved to a different folder or if an item is exported and then imported (even to the same folder).
Each folder has an ID field called Folder.StoreID, the value of which is the same for all the folders in a particular message store. Each folder also has a unique Entry ID field.
When using the GetItemFromID method to retrieve an item based on its ID, you should specify both the EntryID of the item and the StoreID of the folder. If you do not specify the StoreID, GetItemFromID searches the default message store.
The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example illustrates the use of the GetItemFromID method. The code retrieves the StoreID from the default Contacts folder, fills an array (MyEntryID
) with the Entry IDs of all of the contacts in the folder, and finally retrieves a specific contact item:
|
See Also