Skip to Content
CDO & MAPI Programming with Visual Basic:
book

CDO & MAPI Programming with Visual Basic:

by Dave Grundgeiger
October 2000
Intermediate to advanced
384 pages
10h 22m
English
O'Reilly Media, Inc.
Content preview from CDO & MAPI Programming with Visual Basic:

Establishing a MAPI Session

Example 11-5 shows a complete ASP page for creating a CDO Session object and logging on to Exchange Server. Note that this and subsequent examples assume the existence of the global.asa file shown in Example 11-4.

Example 11-5. Establishing a MAPI Session

<!-- #include file="lib.inc" --> <% ' ----------------------------------------------------------------- ' logon.asp ' This page establishes a MAPI session. ' ----------------------------------------------------------------- Dim strUsername Dim strProfileInfo Dim CdoSession Dim CdoFolder Dim CdorlApplication ' Make sure that the user is authenticated. If Request.ServerVariables("AUTH_USER") = "" Then Response.Status = "401 Unauthorized" Response.AddHeader "WWW-Authenticate", "Basic" Response.End End If ' Get the username. strUsername = Request.ServerVariables("AUTH_USER") ' Get the CDORL Application object. This will be used for obtaining ' the security context after logging on to MAPI. Set CdorlApplication = Application.Contents("CdorlApplication") ' Create a CDO Session object. Set CdoSession = Server.CreateObject("MAPI.Session") ' Save the CDO Session object for later use. Set Session.Contents("CdoSession") = CdoSession ' Log on to MAPI. strProfileInfo = "MyExchangeServer" & vbLf & strUsername CdoSession.Logon , , False, True, , , strProfileInfo ' Save the security context. Session.Contents("hImp") = CdorlApplication.ImpID ' The Logon method always succeeds, so try to access something to ' ensure ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
COM Programming with Microsoft® .NET

COM Programming with Microsoft® .NET

John Paul Mueller, Julian Templeman

Publisher Resources

ISBN: 156592665XSupplemental ContentCatalog PageErrata