DOCUMENT:Q252821 26-FEB-2000 [exchange] TITLE :XGEN: Read Contact Properties from ASP Page with VBScript PRODUCT :Microsoft Exchange PROD/VER:winnt:5.5,5.5 SP1,5.5 SP2,5.5 SP3 OPER/SYS: KEYWORDS:exc55 exc55sp1 exc55sp2 exc55sp3 ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Exchange Server, versions 5.5, 5.5 SP1, 5.5 SP2, 5.5 SP3 ------------------------------------------------------------------------------- SUMMARY ======= This article provides an example of how to use VBScript to retrieve the information for a contact in the Contacts folder. MORE INFORMATION ================ The following is an example of VBScript that retrieves and displays several, but not all, of the properties of a contact: <%@ LANGUAGE="VBSCRIPT" %> Document Title <% CONST strServer = "server_name" CONST strMailbox = "mailbox_name" CONST CdoPR_GIVEN_NAME = &H3A06001F 'First Name CONST CdoPR_INITIALS = &H3A0A001E 'Initials CONST CdoPR_SURNAME = &H3A11001E 'Last Name CONST CdoPR_DISPLAY_NAME = &H3001001F 'Display Name CONST CdoPR_ACCOUNT = &H3A00001E 'Alias CONST CdoPR_TITLE = &H3A17001F 'Title CONST CdoPR_COMPANY_NAME = &H3A16001F 'Company CONST CdoPR_BUSINESS_TELEPHONE_NUMBER = &H3A08001F 'BusinessTelephoneNumber Dim objSession Dim objMessages Dim objMessage Dim objFilter Dim strProfileInfo Response.Write ("
Contacts Information Demo

") strProfileInfo = strServer & vbLf & strMailbox Set objSession = CreateObject("MAPI.Session") objSession.Logon , , False, False, , True, strProfileInfo Set objFolder = objSession.GetDefaultFolder(5) Set objMessages = objFolder.Messages Set objFilter = objMessages.Filter For Each objMessage In objMessages if objMessage.Type = "IPM.Contact" then Response.Write(" First Name: " & objMessage.Fields(CdoPR_GIVEN_NAME).Value & "
") Response.Write("Initials: " & objMessage.Fields(CdoPR_INITIALS).Value & "
") Response.Write("Last Name: " & objMessage.Fields(CdoPR_SURNAME).Value & "
") Response.Write("Display Name: " & objMessage.Fields(CdoPR_DISPLAY_NAME).Value & "
") Response.Write("Alias: " & objMessage.Fields(CdoPR_ACCOUNT).Value & "
") Response.Write("Title: " & objMessage.Fields(CdoPR_TITLE).Value & "
") Response.Write("Company: " & objMessage.Fields(CdoPR_COMPANY_NAME).Value & "
") Response.Write("Business Tel: " & objMessage.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER).Value & "
") end if Response.Write("
") Next objSession.Logoff Set objFilter = Nothing Set objAddrEntries= Nothing Set objSession = Nothing %> Additional query words: VBScript ActMsg CDO ASP ====================================================================== Keywords : exc55 exc55sp1 exc55sp2 exc55sp3 Technology : kbExchangeSearch kbExchange550 kbZNotKeyword2 kbExchange550SP1 kbExchange550SP2 kbExchange550SP3 Version : winnt:5.5,5.5 SP1,5.5 SP2,5.5 SP3 Issue type : kbinfo ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2000.