HOWTO: Render a Calendar To an ASP Page with CDO

Last reviewed: February 23, 1998
Article ID: Q181483
The information in this article applies to:
  • Collaboration Data Objects (CDO), version 1.2

SUMMARY

This article contains sample code that will use Collaboration Data Objects (CDO) to render a calendar to an Active Server Pages (ASP) page.

MORE INFORMATION

This is a simple example of how you can render your daily calendar to a Web browser using an ASP page with VBScript and CDO.

Copy and paste the following code to an ASP page. Modify the variables that set the server and mailbox to appropriate values. This code requires Microsoft Exchange Server version 5.5.

Here is the code:

   <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
   <HTML>
   <HEAD>

   </HEAD>
   <BODY>
   <%

   '========================================================
   'CONSTANTS FOR THE CONTAINER RENDERER

   'Time Zone Constants for the US
   CONST CdoDefaultFolderCalendar   = 0
   CONST CdoTmzEastern              = 10
   CONST CdoTmzCentral              = 11
   CONST CdoTmzMountain             = 12
   CONST CdoTmzPacific              = 13
   '========================================================
   'CONTAINER CONSTANT
   CONST CdoClassContainerRenderer  = 3

   strProfileInfo = "MyServer" & vbLf & "MyMailbox"
   Set objSession = Server.CreateObject("MAPI.Session")
   objSession.Logon "", "", False, True, 0, True, strProfileInfo
   objSession.SetOption "calendarstore", "outlook"
   Set objRenderApp = Server.CreateObject("AMHTML.application")
   Set objCRenderer = _
      objRenderApp.CreateRenderer(CdoClassContainerRenderer)
   ObjCRenderer.TimeZone = CdoTmzPacific
   objCRenderer.DataSource = _
      objSession.GetDefaultFolder(CdoDefaultFolderCalendar).Messages
   Set objView = ObjCRenderer.Views("Daily Calendar")
   objCRenderer.CurrentView = objView
   objView.RenderAppointments now, Response
   %>

   </BODY>
   </HTML>


REFERENCES

For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q176916
   TITLE     : INFO: Active Messaging and Collaboration Data Objects (CDO)

For more information about Calendar rendering, please see the topic "Rendering a Calendar" in the Microsoft Developer Network (MSDN) Library.

Keywords          : kbcode cdo
Version           : WINDOWS:1.2
Platform          : WINDOWS
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 23, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.