<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD><TITLE>GAL Display</TITLE></HEAD>
<BODY BGCOLOR=SILVER>
<%
'CONTAINER CONSTANT
CONST CdoClassContainerRenderer = 3
'RENDERSTYLE CONSTANTS
CONST CdoFolderContents = 1
CONST CdoFolderHierarchy = 2
Dim objTableView
Dim objColumn
Dim objSession
Dim objGAL
Dim objALists
Dim objCRenderer
Dim objRenderApp
strProfileInfo= "/o=<enterprise>/ou=<site>/cn=Configuration/cn=Servers/cn=<server name>" & vbLf & vblf & "anon"
' TODO: Replace <enterprise> with the name of your enterprise, and <site> with the name of your site.
'Create a MAPI logon to the specified mailbox
Set objSession= CreateObject("MAPI.Session")
objSession.Logon , , False, True, 0, True, strProfileInfo
Set objRenderApp = Server.CreateObject("AMHTML.application")
Set objCRenderer = _
objRenderApp.CreateRenderer(CdoClassContainerRenderer)
Set objALists = objSession.AddressLists
Set objGAL = objALists.Item("Global Address List")
objCRenderer.RowsPerPage = 100
%>
<DIV STYLE="background-color:GRAY"><FONT SIZE=4 COLOR=WHITE>
Global Address List:</FONT></DIV>
<%
'Assign rendering object.
objCRenderer.datasource = objGAL.AddressEntries
'There are no default views associated with the
'Global Address List (GAL), so a new one must be created.
Set objTableView = objCRenderer.Views.Add("viewGAL")
'Add a column in the table for each MAPI field you want to see and
'give the HTML tags for how you would like each of them to be rendered.
'Add Display name column.
Set objColumn = objTableView.Columns.Add("Display Name", _
"PR_Display_NAME" ,150, 8 ,1)
objColumn.RenderUsing = "<B>%value%</B>"
'Add phone column.
Set objColumn = objTableView.Columns.Add("Phone", _
"PR_BUSINESS_TELEPHONE_NUMBER" ,100, 8 ,2)
objColumn.RenderUsing = "%value%"
'Add office column.
Set objColumn = objTableView.Columns.Add("Office", _
"PR_OFFICE_LOCATION" ,100, 8 ,3)
objColumn.RenderUsing = "%value%"
'Add Title name column.
Set objColumn = objTableView.Columns.Add("Title", "PR_TITLE", _
100, 8 ,4)
objColumn.RenderUsing = "<U>%value%</U>"
'Add Company column.
Set objColumn = objTableView.Columns.Add("Company", _
"PR_COMPANY_NAME" ,100, 8 ,5)
objColumn.RenderUsing = "%value%"
'Add Alias column.
Set objColumn = objTableView.Columns.Add("Alias", "PR_ACCOUNT", _
100, 8 ,6)
objColumn.RenderUsing = "%value%"
'Make the view we created the current view used.
objCRenderer.CurrentView=objTableView
'Render the object.
Response.write(objCRenderer.Render(CdoFolderContents))
'Clean up Session & Rendering Objects.
set objsession = nothing
set objrenderapp = nothing
set objCRenderer = nothing
%>
</BODY>
</HTML>