PSS ID Number: Q179332
Article Last Modified on 04-30-2000
This article describes how to programmatically gain anonymous access to a
public folder on your Microsoft Exchange Server from an Active Server Page
(ASP) page.
Please note that you can gain non-programmatic anonymous access to any
public folder on the Exchange Server using the built in Hypertext Transfer
Protocol (HTTP) supported by Exchange Server.
To gain anonymous programmatic access to an Exchange Public folder from an ASP page, you need to setup several components of Windows NT, Exchange and Internet Information Server (IIS) correctly. This example creates a new user on the domain using "User Manager for Domains," the "Microsoft Exchange Administrator," and the "Internet Service Manager."
Username: AnonUser
Full Name: Anonymous User.
Description: For anonymous Web access to Public Folders
Password: Fill in an appropriate password.
Confirm Password: Repeat password.
User Must Change Password at Next Logon: OFF
User Cannot Change Password: ON*
Password Never Expires: ON*
Account Disabled: OFF
NOTE: You may set these values to OFF. If you set these values OFF, you need to change the password in the IIS Manager as well as in the
account.
Groups: Member of: Domain Users
Domain Guests
Profiles: User Profiles or Home Directory settings are not
required.
Hours: No settings are required.
Logon to: Set as appropriate.
Account: Account Expires: Never
Account Type: Global Account for regular user
accounts in the domain.
Dialin: "Grant dialin permissions to user": OFF
"Call Back": No Call Back.
First Name: Anonymous
Last Name: User
Display: Anonymous User
Alias: AnonUser
Primary NT Account: DOMAIN\AnonUser
Anonymous Logon
---------------
UserName: AnonUser
Password: Fill in the password you created while creating the
Anonymous User account. Confirm the password in the
appropriate dialog box.
Password Authentication
-----------------------
Allow Anonymous: ON
Basic (Clear Text): As Desired
Windows NT Challenge Response: As Desired*
* You may want to turn Windows NT Challenge Response ON so
you can author to the Web from another computer.
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html;charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<%
CONST strServer = "MyExchangeServer"
CONST strMailbox = "AnonUser"
Dim objSession
Dim objMessages
Dim objOneMessage
Dim objInfoStores
Dim objInfoStore
Dim objTopFolder
Dim objFolders
Dim objSubFolder
Dim objTargetFolder
Dim strProfileInfo
Dim i
Dim bstrPublicRootID
strProfileInfo = strServer & vblf & strMailbox
Set objSession = Server.CreateObject("MAPI.Session")
objSession.Logon , , , False, , True, strProfileInfo
Set objInfoStores = objSession.InfoStores
For i = 1 To objInfoStores.Count
If objInfoStores.Item(i)= "Public Folders" Then
Set objInfoStore=objInfoStores.Item(i)
Exit For
End If
Next
bstrPublicRootID = objInfoStore.Fields.Item( &H66310102 ).Value
Set objTopFolder = objSession.GetFolder(bstrPublicRootID, _
objInfoStore.ID)
Set objFolders = objTopFolder.Folders
Set objFolder = objFolders.GetFirst()
Do Until objFolder.Name = "Internet Newsgroups"
Set objFolder=objFolders.GetNext()
Loop
Set objMessages = objFolder.Messages
For Each objOneMessage in objMessages
Response.Write("objOneMessage.Subject = " & _
objOneMessage.Subject & "<br>")
Response.Write("objOneMessage.Text = " & _
objOneMessage.Text & "<br>")
Next
objSession.Logoff
Set objOneMessage = Nothing
Set objMessages = Nothing
Set objFolder = Nothing
Set objTopFolder = Nothing
Set objSession = Nothing
%>
</BODY>
</HTML>
For more information please see "Implementing a Secure Site with ASP," located at:
http://www.microsoft.com/isn/techcenter/security.htmFor additional information on designating Public Folders for Web access, please see the following article in the Microsoft Knowledge Base:
Q168661 PRB: Accessing Public Folders Via a Web Browser Causes Error
Additional query words:
Keywords: kbASP kbCDO120 kbCDO121 kbMsg kbVBScript kbGrpDSMsg
Issue Type: kbhowto
Technology: kbAudDeveloper kbCDOsearch kbExchangeSearch kbCDO120 kbCDO121