Article ID: 170991 - Last Review: February 12, 2007 - Revision: 1.4 OL97: Programming With EntryIDs, StoreIDs, and GetItemFromIDThis article was previously published under Q170991 SUMMARY
This article provides an example of using the GetItemFromID method in the
Microsoft Outlook 97 object model.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) A common use of the GetItemFromID method is to create a link, or relationship, from one Outlook item to another. The Outlook Visual Basic Help file (Vbaoutl.hlp) documents this method. For more information on obtaining the Outlook Visual Basic Help file, please see the following article in the Microsoft Knowledge Base: 166738
(http://support.microsoft.com/kb/166738/EN-US/
)
OL97: How to Install Visual Basic Help
An example of when you might want to use the GetItemFromID method is if you
created contact items for all members of a family instead of just having
one contact item for the head of the household. You might want to create a
custom contact form so that you can create "links" between all members of
the family. This could be in the form of a list box on the custom contact
form that would automatically include a list of other members of the
family. Using the custom form, when you select a person from the list,
their contact item would automatically display.
In a solution like this, you would typically create the links between the contact items by storing the related IDs with each contact. So each contact item might have 20 user-defined fields that store the IDs of up to 20 related contacts. VBScript code uses these IDs to retrieve the names of the other family members in order to populate the list and to retrieve the other contact item when the user selects a name from the list. Each Outlook item (contacts, messages, appointments, and such) has a field called EntryID, which is a unique ID field generated by the messaging storage system for use with the MAPI folders which store the item. Each MAPI folder has a field called StoreID, a unique ID field for that particular folder. Each folder also has an EntryID field. When using the GetItemFromID method to retrieve an item based on its MAPI IDs, you need to specify both the EntryID of the item and the StoreID of the folder. Using the EntryID of the folder instead of the StoreID will generate an error, which may vary depending on the type of folder you are working with. The following is a VBScript example which illustrates the use of the GetItemFromID method. The code retrieves the StoreID from the default Contacts folder, fills an array with the EntryIDs for all of the contacts in the folder, and finally retrieves a specific contact item. REFERENCES
For more information about creating solutions with Microsoft Outlook 97,
please see the following articles in the Microsoft Knowledge Base:
166368
(http://support.microsoft.com/kb/166368/EN-US/
)
OL97: How to Get Help Programming with Outlook
170783
(http://support.microsoft.com/kb/170783/EN-US/
)
OL97: Q&A: Questions about Customizing or Programming Outlook
| Article Translations
|

Back to the top
