shahine.com/omar/

homepage | Send mail to the author(s) contact

yet another Microsoft blogger

# Monday, June 27, 2005

Updated:

99% of the appointments on my calendar say "Updated: <original appointment name>". I don't find this particularly useful, especially when I look at my calendar on a small screen like the Treo 650, or even smaller Windows Mobile Device. Half the time I have no idea what was Updated anyway, and I just blindly accept the meeting request.

In fact, most meetings go like this:

  1. You get a Meeting Request for a meeting
  2. 2 min later you get another meeting request because the person:
    • Forgot to make it recurring
    • Could not get the conference room
    • Added some attendees
    • Moved it to a new time because person foo could not make it
  3. Some time later, due to issues with step 2 you get another appointment.

If you are lucky enough to get to Step 3, you will often find that Outlook will display a message that says "Object moved" when you try and delete, accept or do anything with the third meeting request. I have no idea why.

Anyway, to make the calendar more useful, i wrote a little command line app that will simply remove "Updated: " and "FW: " from the beginning of any appointments on your calendar.

You can download it here, or in the RSS enclosure.

Usual disclaimer applies. This works on my machine, did not do bad, and I am not responsible for what it does on your machine. You must have the Outlook .NET Programability Installed for Outlook 2003.

The code looks like this:

static void Main()
{
    string[] prefixes = new string[] {"Updated: ", "FW: "};
    try
    {
        Application application = new Application();
        MAPIFolder calendar = application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderCalendar);

        int counter = 0;

        foreach (object o in calendar.Items)
        {
            if (o is AppointmentItem)
            {
                AppointmentItem appointmentItem = (AppointmentItem)o;

                foreach (string s in prefixes)
                {
                    if (appointmentItem.Subject.ToLower().StartsWith(s.ToLower()))
                    {
                        string currentSubject = appointmentItem.Subject;
                        string cleanSubject = currentSubject.Remove(0, s.Length);
                        appointmentItem.Subject = cleanSubject;
                        appointmentItem.Save();
                
                        Console.WriteLine("subject: {0}", currentSubject);
                        Console.WriteLine(" new subject: {0}", cleanSubject);
                
                        counter++;
                    }
                }
            }
        }
    
        Console.WriteLine("Cleaned {0} of {1} Appointments", counter, calendar.Items.Count);
        Console.WriteLine("Press any key to exit.");
        Console.ReadLine();
    }
    catch (System.Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
}

Posted Tuesday, June 28, 2005    Permalink    Comments [5]  View blog reactions

CleanCalendar.zip (2.41 KB)

 

Tuesday, June 28, 2005 7:12:32 AM (Pacific Daylight Time, UTC-07:00)
Those are some simple but cool bits. Worked like magic on my system. I've always hated the Updated: feature myself and often manually change them. No more!
CuriousGeorge
Tuesday, June 28, 2005 9:43:17 AM (Pacific Daylight Time, UTC-07:00)
Is there a way that you make this run when Outlook is opened? That way it does a quick cleanup each time (perhaps I'll put a "if it's Monday, do the cleaning" check in mine to minimize overhead)
Tuesday, June 28, 2005 1:33:25 PM (Pacific Daylight Time, UTC-07:00)
Brian-

Yeah, that would be nice, but I am afraid of writing another Outlook Add-in. It's 1000% more work than a Command Line app.

I would create a scheduled task that runs the exe once a week, or once a day.

-Omar
Friday, July 01, 2005 2:06:59 PM (Pacific Daylight Time, UTC-07:00)
yeah, we know most Microsoft Products are built around features rather than benefits. Your story is another example of the symptom.
Monday, April 07, 2008 5:37:07 AM (Pacific Daylight Time, UTC-07:00)
I loved this app (Not Outlook !) but it doesn't work anymore ? Did you ever update it ?

Thx.
Chris
Comments are closed.