Discussion:
Displaying Exchange Global Address Book ASP
(too old to reply)
NH
2004-06-16 17:16:55 UTC
Permalink
I am using the following code from the Microsoft website to display the MS
Exchange global address book as a phonelist on our intranet. The problem is
that it displays all contacts, including 'Administrator' and various other
email accounts which are not 'contacts' as such.

Is there any way I can modify this code to filter out certain items from the
list? (The list of items to remove is fairly short, so they could be listed
in an IF statement if that is the easiest way)

I don't know where to begin...

Thanks

====Start of code==========
<%@ 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>

====End of code==========
Stefan B Rusynko
2004-06-16 18:16:25 UTC
Permalink
This visual basic programming newsgroup has been discontinued for quite some
time. You may wish to post in microsoft.public.frontpage.programming


PS
Pleas don't cross post
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"NH" <***@thegroup.com> wrote in message news:%***@TK2MSFTNGP11.phx.gbl...
| I am using the following code from the Microsoft website to display the MS
| Exchange global address book as a phonelist on our intranet. The problem is
| that it displays all contacts, including 'Administrator' and various other
| email accounts which are not 'contacts' as such.
|
| Is there any way I can modify this code to filter out certain items from the
| list? (The list of items to remove is fairly short, so they could be listed
| in an IF statement if that is the easiest way)
|
| I don't know where to begin...
|
| Thanks
|
| ====Start of code==========
| <%@ 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>
|
| ====End of code==========
|
|
NH
2004-06-16 20:48:43 UTC
Permalink
Thank you.

What is wrong with cross-posting?

I have never understood why it is frowned upon.

Are you saying that I should not post the question in two different
locations, or just not both at the same time?

If I have a question which involves two different elements, MS Exchange and
MS FrontPage, surely it is far better to cross-post so that readers from
either group can offer their advice. I appreciate that it annoying to see
the same question asked in several closely related groups, as a reader of
one will be likely to be reader of another, but in a case like this limiting
my query to one group would be foolish, as the query is equally appropriate
to both groups, and I would only be receiving advice from one 'angle'. I
regularly find that it is a combination of two different viewpoints, from
two different newsgroups which solves a problem.

Have I misunderstood why cross-posting is a no-no?

NH
Post by Stefan B Rusynko
This visual basic programming newsgroup has been discontinued for quite some
time. You may wish to post in microsoft.public.frontpage.programming
PS
Pleas don't cross post
--
_____________________________________________
"Warning - Using the F1 Key will not break anything!" (-;
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________
| I am using the following code from the Microsoft website to display the MS
| Exchange global address book as a phonelist on our intranet. The problem is
| that it displays all contacts, including 'Administrator' and various other
| email accounts which are not 'contacts' as such.
|
| Is there any way I can modify this code to filter out certain items from the
| list? (The list of items to remove is fairly short, so they could be listed
| in an IF statement if that is the easiest way)
|
| I don't know where to begin...
|
| Thanks
|
| ====Start of code==========
| <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>
|
| ====End of code==========
|
|
Tom Pepper Willett
2004-06-16 22:57:06 UTC
Permalink
Moot point. This newsgroup has been discontinued.
--
=====================================================
Tom Pepper Willett [Microsoft MVP - FrontPage]
----------------------------------------------------------------------------
-------------------
Microsoft FrontPage:
http://www.microsoft.com/office/frontpage/prodinfo/default.mspx
http://msdn.microsoft.com/office/understanding/frontpage/
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
=====================================================
"NH" <***@thegroup.com> wrote in message news:OQTLbN%***@TK2MSFTNGP12.phx.gbl...
| Thank you.
|
| What is wrong with cross-posting?
|
| I have never understood why it is frowned upon.
|
| Are you saying that I should not post the question in two different
| locations, or just not both at the same time?
|
| If I have a question which involves two different elements, MS Exchange
and
| MS FrontPage, surely it is far better to cross-post so that readers from
| either group can offer their advice. I appreciate that it annoying to see
| the same question asked in several closely related groups, as a reader of
| one will be likely to be reader of another, but in a case like this
limiting
| my query to one group would be foolish, as the query is equally
appropriate
| to both groups, and I would only be receiving advice from one 'angle'. I
| regularly find that it is a combination of two different viewpoints, from
| two different newsgroups which solves a problem.
|
| Have I misunderstood why cross-posting is a no-no?
|
| NH
|
|
| "Stefan B Rusynko" <***@hotmail.com> wrote in message
| news:%***@TK2MSFTNGP11.phx.gbl...
| > This visual basic programming newsgroup has been discontinued for quite
| some
| > time. You may wish to post in microsoft.public.frontpage.programming
| >
| >
| > PS
| > Pleas don't cross post
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > "NH" <***@thegroup.com> wrote in message
| news:%***@TK2MSFTNGP11.phx.gbl...
| > | I am using the following code from the Microsoft website to display
the
| MS
| > | Exchange global address book as a phonelist on our intranet. The
problem
| is
| > | that it displays all contacts, including 'Administrator' and various
| other
| > | email accounts which are not 'contacts' as such.
| > |
| > | Is there any way I can modify this code to filter out certain items
from
| the
| > | list? (The list of items to remove is fairly short, so they could be
| listed
| > | in an IF statement if that is the easiest way)
| > |
| > | I don't know where to begin...
| > |
| > | Thanks
| > |
| > | ====Start of code==========
| > | <%@ 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>
| > |
| > | ====End of code==========
| > |
| > |
| >
| >
|
|
Loading...