Microsoft KB Archive/252821: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "<" to "<")
Line 57: Line 57:
<div class="indent">
<div class="indent">


&lt;%@ LANGUAGE=&quot;VBSCRIPT&quot; %&gt;<br />
<%@ LANGUAGE=&quot;VBSCRIPT&quot; %&gt;<br />
<br />
<br />
&lt;HTML&gt;<br />
<HTML&gt;<br />
&lt;HEAD&gt;<br />
<HEAD&gt;<br />
&lt;META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br />
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br />
&lt;META HTTP-EQUIV=&quot;Content-Type&quot; content=&quot;text/html;charset=iso-8859-1&quot;&gt;<br />
<META HTTP-EQUIV=&quot;Content-Type&quot; content=&quot;text/html;charset=iso-8859-1&quot;&gt;<br />
&lt;TITLE&gt;Document Title&lt;/TITLE&gt;<br />
<TITLE&gt;Document Title</TITLE&gt;<br />
&lt;/HEAD&gt;<br />
</HEAD&gt;<br />
&lt;BODY&gt;<br />
<BODY&gt;<br />




Line 72: Line 72:
<div class="indent">
<div class="indent">


&lt;%<br />
<%<br />
CONST strServer = &quot;server_name&quot;<br />
CONST strServer = &quot;server_name&quot;<br />
CONST strMailbox = &quot;mailbox_name&quot;<br />
CONST strMailbox = &quot;mailbox_name&quot;<br />
Line 105: Line 105:
<div class="indent">
<div class="indent">


Response.Write (&quot;'''&lt;BR&gt;&lt;Center&gt;Contacts Information Demo&lt;/center&gt;'''&lt;BR&gt;&quot;)
Response.Write (&quot;'''<BR&gt;<Center&gt;Contacts Information Demo</center&gt;'''<BR&gt;&quot;)




Line 143: Line 143:
if objMessage.Type = &quot;IPM.Contact&quot; then<br />
if objMessage.Type = &quot;IPM.Contact&quot; then<br />
<br />
<br />
Response.Write(&quot; '''First Name:''' &quot; &amp; objMessage.Fields(CdoPR_GIVEN_NAME).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot; '''First Name:''' &quot; &amp; objMessage.Fields(CdoPR_GIVEN_NAME).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Initials:''' &quot; &amp; objMessage.Fields(CdoPR_INITIALS).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Initials:''' &quot; &amp; objMessage.Fields(CdoPR_INITIALS).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Last Name:''' &quot; &amp; objMessage.Fields(CdoPR_SURNAME).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Last Name:''' &quot; &amp; objMessage.Fields(CdoPR_SURNAME).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Display Name:''' &quot; &amp; objMessage.Fields(CdoPR_DISPLAY_NAME).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Display Name:''' &quot; &amp; objMessage.Fields(CdoPR_DISPLAY_NAME).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Alias:''' &quot; &amp; objMessage.Fields(CdoPR_ACCOUNT).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Alias:''' &quot; &amp; objMessage.Fields(CdoPR_ACCOUNT).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Title:''' &quot; &amp; objMessage.Fields(CdoPR_TITLE).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Title:''' &quot; &amp; objMessage.Fields(CdoPR_TITLE).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Company:''' &quot; &amp; objMessage.Fields(CdoPR_COMPANY_NAME).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Company:''' &quot; &amp; objMessage.Fields(CdoPR_COMPANY_NAME).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
Response.Write(&quot;'''Business Tel:''' &quot; &amp; objMessage.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER).Value &amp; &quot;&lt;br&gt;&quot;)<br />
Response.Write(&quot;'''Business Tel:''' &quot; &amp; objMessage.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER).Value &amp; &quot;<br&gt;&quot;)<br />
<br />
<br />
end if<br />
end if<br />
<br />
<br />
Response.Write(&quot;&lt;HR&gt;&quot;)<br />
Response.Write(&quot;<HR&gt;&quot;)<br />
Next<br />
Next<br />


Line 174: Line 174:
Set objSession = Nothing<br />
Set objSession = Nothing<br />
%&gt;<br />
%&gt;<br />
&lt;/BODY&gt; &lt;/HTML&gt;
</BODY&gt; </HTML&gt;





Revision as of 09:01, 21 July 2020

Knowledge Base


XGEN: Read Contact Properties from ASP Page with VBScript

Article ID: 252821

Article Last Modified on 10/27/2006



APPLIES TO

  • Microsoft Exchange Server 5.5 Standard Edition
  • Microsoft Exchange Server 5.5 Service Pack 1
  • Microsoft Exchange Server 5.5 Service Pack 2
  • Microsoft Exchange Server 5.5 Service Pack 3



This article was previously published under Q252821

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" %>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<META HTTP-EQUIV="Content-Type" content="text/html;charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>


<%
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 ("<BR><Center>Contacts Information Demo</center><BR>")


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 & "<br>")

Response.Write("Initials: " & objMessage.Fields(CdoPR_INITIALS).Value & "<br>")

Response.Write("Last Name: " & objMessage.Fields(CdoPR_SURNAME).Value & "<br>")

Response.Write("Display Name: " & objMessage.Fields(CdoPR_DISPLAY_NAME).Value & "<br>")

Response.Write("Alias: " & objMessage.Fields(CdoPR_ACCOUNT).Value & "<br>")

Response.Write("Title: " & objMessage.Fields(CdoPR_TITLE).Value & "<br>")

Response.Write("Company: " & objMessage.Fields(CdoPR_COMPANY_NAME).Value & "<br>")

Response.Write("Business Tel: " & objMessage.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER).Value & "<br>")

end if

Response.Write("<HR>")
Next


objSession.Logoff
Set objFilter = Nothing
Set objAddrEntries= Nothing
Set objSession = Nothing
%>
</BODY> </HTML>



Additional query words: VBScript ActMsg CDO ASP

Keywords: kbinfo KB252821