HOWTO: Write a VBScript MessageFilter in an ASP PageLast reviewed: January 6, 1998Article ID: Q178509 |
The information in this article applies to:
SUMMARYYou can use a message filter in an Active Server Page (ASP) utilizing Microsoft Visual Basic Script (VBScript) to filter your appointment calendar. This article contains sample code that demonstrates how to use VBScript for the message filter.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.asp Sample CodeCreate a new ASP file and paste the following code into the ASP file:
<%@ 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 = "MyMailbox" Const CdoDefaultFolderCalendar = 0 Const CdoPR_START_DATE = &H600040 Const CdoPR_END_DATE = &H610040 Dim objSession Dim objCalendarFolder Dim objAppointments Dim objAppointmentFilter Dim objOneAppointment Dim strProfileInfo Dim StartTime Dim EndTime Dim objAppointmentFilterField1 Dim objAppointmentFilterField2 strProfileInfo = strServer & vbLf & strMailbox Set objSession = Server.CreateObject("MAPI.Session") objSession.Logon , , False, False, 0, True, strProfileInfo 'Fill in a date/time using a vbDate format. 'For example, StartTime = #1/1/98 9:30 AM#. This vbDate 'filters appointments that started AFTER 9:30 AM on 'January 1, 1998. Use StartTime and EndTime in combination 'to filter a specific date. For example, if you wanted to filter 'all your appointments on January 1, 1998, you would use 'StartTime = #1/1/98# 'EndTime = #1/2/98# 'This combination filters all appointments starting 'AFTER Janury 1, 1998 at midnight, and all appointments ending 'BEFORE January 2, 1998 at midnight. 'You can further refine your filter by adding times to the 'StartTime and EndTime. StartTime = #12/18/97 2:00:00 PM# EndTime = #12/19/97# Set objCalendarFolder = _ objSession.GetDefaultFolder(CdoDefaultFolderCalendar) Set objAppointments = objCalendarFolder.Messages Set objAppointmentFilter = objAppointments.Filter 'NOTE: Use the EndTime in the Start_Date field and the 'StartTime in the End_Date field. Set objAppointmentFilterField1 = _ objAppointmentFilter.Fields.Add(CdoPR_START_DATE, EndTime) Set objAppointmentFilterField2 = _ objAppointmentFilter.Fields.Add(CdoPR_END_DATE, StartTime) For Each objOneAppointment In objAppointments Response.Write("objOneAppointment.Subject = " & _ objOneAppointment.Subject & "<br>") Response.Write("objOneAppointment.StartTime = " & _ objOneAppointment.StartTime & "<br>") Response.Write("objOneAppointment.EndTime = " & _ objOneAppointment.EndTime & " <br>") Response.Write("objOneAppointment.Duration = " & _ objOneAppointment.Duration & "<br> <br>") Next Response.Write("Done <br>") objSession.Logoff Set objOneAppointment = Nothing Set objAppointments = Nothing Set objCalendarFolder = Nothing Set objSession = Nothing %> </BODY> </HTML> Keywords : kbcode cdo kbInetDev AXSFVBS Version : WINDOWS:1.2; WINNT:1.0,1.0b Platform : WINDOWS winnt Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |