Querying an Exchange Calendar Quickie!

Results 1 to 2 of 2

Thread: Querying an Exchange Calendar Quickie!

  1. #1
    Join Date
    Dec 1969

    Default Querying an Exchange Calendar Quickie!

    I&#039;m using ASP to extract calendar appointments from an Exchange 5.5 server. I can get the code working when using a hard-coded in date, but I can&#039;t get it to work by supplying a date programmatically.<BR><BR>Here&#039;s the code (slightly modified from the MS example):<BR><BR> Const strServer = "mail-server"<BR> Const strMailbox = "my-mailbox"<BR> Const CdoDefaultFolderCalendar = 0<BR> Const CdoPR_START_DATE = &H600040<BR> Const CdoPR_END_DATE = &H610040<BR> Dim objSession<BR> Dim objCalendarFolder<BR> Dim objAppointments<BR> Dim objAppointmentFilter<BR> Dim objOneAppointment<BR> Dim strProfileInfo<BR> Dim StartTime<BR> Dim EndTime<BR> Dim objAppointmentFilterField1<BR> Dim objAppointmentFilterField2<BR><BR> strProfileInfo = strServer & vbLf & strMailbox<BR> Set objSession = Server.CreateObject("MAPI.Session")<BR> objSession.Logon , , False, True, 0, True, strProfileInfo<BR> <BR> StartTime = #11/01/2002#<BR> EndTime = #12/01/2002#<BR><BR> Set objCalendarFolder = objSession.GetDefaultFolder(CdoDefaultFolderCalend ar)<BR> Set objAppointments = objCalendarFolder.Messages<BR> Set objAppointmentFilter = objAppointments.Filter<BR><BR> &#039;NOTE: Use the EndTime in the Start_Date field and the<BR> &#039;StartTime in the End_Date field.<BR> Set objAppointmentFilterField1 = objAppointmentFilter.Fields.Add(CdoPR_START_DATE, EndTime)<BR> Set objAppointmentFilterField2 = objAppointmentFilter.Fields.Add(CdoPR_END_DATE, StartTime)<BR><BR> For Each objOneAppointment In objAppointments<BR> Response.Write("Subject = " & objOneAppointment.Subject & "<BR>")<BR> Response.Write("StartTime = " & objOneAppointment.StartTime & "<BR>")<BR> Response.Write("EndTime = " & objOneAppointment.EndTime & " <BR>")<BR> Response.Write("Duration = " & objOneAppointment.Duration & "<BR> <BR>")<BR> Next<BR> Response.Write("Done <BR>")<BR> objSession.Logoff<BR> Set objOneAppointment = Nothing<BR> Set objAppointments = Nothing<BR> Set objCalendarFolder = Nothing<BR> Set objSession = Nothing<BR> %&#062;<BR><BR>It&#039;s the part where the two dates are assigned to the "StartTime" and "EndTime" variables.<BR><BR>Any ideas?

  2. #2
    Join Date
    Dec 1969

    Default Just a thought...

    Try:<BR><BR>StartTime = cdate(#11/01/2002#)<BR><BR>Also, I&#039;m not sure about those pound signs. That&#039;s an access thing, so it may be required for exchange--I don&#039;t know. If it doesn&#039;t work, though try: <BR><BR>StartTime = cdate(11/01/2002)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts