PDA

View Full Version : How to show my Outlook Express Address book at ASP page



superman2004
12-27-2004, 05:13 AM
anyone here know how can i show all my addresses in Outlook Express at a ASP Page?i have found a coding that can do it, but i really cannot make it work.



<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD><TITLE>Sent Items Display</TITLE></HEAD>
<BODY BGCOLOR=SILVER>
<%

'On Error Resume Next 'CONTAINER CONSTANT
CONST CdoClassContainerRenderer = 3
CONST CdoClassObjectRenderer = 2 'RENDERSTYLE CONSTANTS
CONST CdoFolderContents = 1
CONST CdoFolderHierarchy = 2 '===== Default Folder Constants ========
'These constants are passed into the Session.GetDefaultFolder()
'method to return their respective folders. CONST CdoDefaultFolderCalendar = 0
CONST CdoDefaultFolderInbox = 1
CONST CdoDefaultFolderOutbox = 2
CONST CdoDefaultFolderSentItems = 3
CONST CdoDefaultFolderDeletedItems = 4
CONST CdoDefaultFolderContacts = 5
CONST CdoDefaultFolderJournal = 6
CONST CdoDefaultFolderNotes = 7
CONST CdoDefaultFolderTasks = 8
CONST CdoDefaultFolderTotal = 9
'=================================== strProfileInfo= "ServerName" & vbLf & "MailboxName" ' Create a MAPI logon to the specified mailbox.
Set objSession= CreateObject("MAPI.Session")
objSession.Logon , , False, True, 0, True, strProfileInfo ' Create a container rendering application.
Set objRenderApp = Server.CreateObject("AMHTML.application")
Set objCRenderer = _
objRenderApp.CreateRenderer(CdoClassContainerRenderer)
'There are two ways to format data with a CDO Rendering application:
' 1 - By setting a format to a field of the message and rendering
' that field a certain way depending on the value of the
' information.
' 2 - Render a column of data all in the same fashion. ' format importance field
Set cFormat = objCRenderer.Formats.Add("PR_Importance")
' The images below must exist on the server where the script is located.
Set cPattern = cFormat.Patterns.Add(0,"<img src=low.gif>")
Set cPattern = cFormat.Patterns.Add(1,"<img src=invisibl.gif>")
Set cPattern = cFormat.Patterns.Add(2,"<img src=urgent.gif>") ' Format Class field.
Set cFormat = objCRenderer.Formats.Add("PR_Message_Class")
Set cPattern = cFormat.Patterns.Add("IPM.Note", _
"<img src=newmail.gif>")
Set cPattern = cFormat.Patterns.Add("IPM.AppointmentItem", _
"<img src=newappt.gif>")
Set cPattern = cFormat.Patterns.Add("IPM.Post","<img src=post.gif>")
Set cPattern = cFormat.Patterns.Add("IPM.Contact", _
"<img src=meeting.gif>") ' Format Attachment field.
Set cFormat = objCRenderer.Formats.Add("PR_HASATTACH")
Set cPattern = cFormat.Patterns.Add(0,"<img src=invisibl.gif>")
Set cPattern = cFormat.Patterns.Add(1,"<img src=papclip.gif>") ' Set the datasource to the appropriate folder.
' This will set the container to be rendered to the Sent items folder
objCRenderer.DataSource= _
objSession.GetDefaultFolder(CdoDefaultFolderSentItems).Messages
' Use the default predefined view.
Set objTableView = objCRenderer.Views(1) ' Add body column and render it in blue.
' set objColumn = _
' objTableView.Columns.Add("Body", "PR_Body" ,150, 8 ,8) ' objColumn.RenderUsing = "<font color=blue>%value%</font>" 'Render the object
Response.write(objCRenderer.Render(CdoFolderContents)) 'Clean up Session & Rendering Objects.
set objsession = nothing
set objrenderapp = nothing
set objCRenderer = nothing %>
</BODY>
</HTML>


Is it need to change the ServerName and the MailBoxName?

Normally how the servername and mailboxname look like? is it in IP format?