DCSIMG
May 2007 - Posts - Windowmaker's blog

May 2007 - Posts

For a while I have been posting at http://blogs.microsoft.co.il/blogs/guyt/, but it seams that I have managed to stumple upon some bug and some of my posts are not geting indexed by search engines. As a result I have copied all the posts I made at http://blogs.microsoft.co.il/blogs/guyt/ to my blog at http://guy.netguru.co.il. I have talked to Yosi Taguri who is running the MS Israel blogs webserver and he is looking into it. I will be cross-posting to both blogs for a while till this issue is sorted out.

 

Recently I had a customer who, instead of deploying the 2007 daylight savings hotfixes, just moved the entire organization's clock one hour forward. In order to provide a solution I had to cope with several issues:

  • Meetings scheduled with people outside of the company being shifted by one hour
  • Some users decided to manually install the updates and the organization had to be baselined before deploying the necessary hotfixes.
  • Because of the possible issues related to meeting appointments being adjusted incorrectly using Exchange Calendar Update Tool, it was decided that all meetings have to be stamped with the meeting start and end time in the subject.

I searched the internet and did not find much that I could use for stamping the appointment's subject, so I resorted to writing a very small application in VB using CDO COM object - something that could be either manually executed by a user or launched from a logon script. What I basically do is to iterate throw all the meeting appointments in the calendar, while ignoring all day appointments, and adding the meeting start and end time in the subject. This way, even if the appointment is mistakenly moved as a result of daylight time adjustments, you will still know the time it was scheduled for initially.

Here is the code:

Dim objSession As New MAPI.Session      ' Session object
Dim objCalendarFolder As Folder         ' Folder object
Dim objCalMessages As Messages          ' Messages collection
Dim objAppointment As AppointmentItem   ' Appointment object
Dim strNewSubject As String             ' New subject
Dim strStartTime As String              ' Appointment start time
Dim strEndTime As String                ' Appointment end time
Dim strTimePrefix As String

objSession.Logon

' get the calendar folder
Set objCalendarFolder = objSession.GetDefaultFolder( _
    CdoDefaultFolderTypes.CdoDefaultFolderCalendar)
' get all the items from the calendar
Set objCalMessages = objCalendarFolder.Messages

Set objAppointment = objCalMessages.GetFirst
Do While Not objAppointment Is Nothing
    If Not objAppointment.AllDayEvent Then
        strStartTime = Format(objAppointment.StartTime, "h:mm AM/PM")
        strEndTime = Format(objAppointment.EndTime, "h:mm AM/PM")
        strTimePrefix = strStartTime & " - " & strEndTime

        ' We do not want to stamp the same appointment twice
        If InStr(objAppointment.Subject, strTimePrefix) = 0 Then
            strNewSubject = strTimePrefix & " :: " & objAppointment.Subject
            objAppointment.Subject = strNewSubject
            objAppointment.Update
        End If
    End If

    Set objAppointment = objCalMessages.GetNext
Loop
objSession.Logoff

 

If you want the executable, get it here.

Posted by Guy Teverovsky | with no comments