HOWTO: Programmatically Gain Anonymous Access to Public FoldersLast reviewed: January 16, 1998Article ID: Q179332 |
The information in this article applies to:
SUMMARYThis 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.
MORE INFORMATIONTo 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."
User Manager for Domains
Microsoft Exchange Administrator
Microsoft Internet Service Manager
Now your system is configured to allow an anonymous user to gain access to the Public Folders on your Exchange Server. Your ASP code must reflect the settings you have created. When logging into the session your code should log you onto the mailbox of "AnonUser" as demonstrated in the following code. This sample code shows how to gain access to the Internet Newsgroups folder. Here is the sample code:
<%@ 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> REFERENCESFor 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:
ARTICLE-ID: Q168661 TITLE : PRB: Accessing Public Folders Via a Web Browser Causes Error Keywords : cdo Version : WINDOWS:1.2 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |