Dr Fragen in the operating room

iCal – Exchange Time Zone Fix

·

As any Mac user who deals with Microsoft Exchange invites will tell you Exchange screws up the time zone information. What this means is that you will likely miss your meetings. Not a good thing.
Justin Hartman has recently given you his solution to this problem. I haven’t tested it but in looking at it I’m certain it works just fine. I say this because he’s fixing the problem is a similar manner. It’s just that he’s using a combination of shell scripts and AppleScripts. I’ve got it down to a single AppleScript.
There is one property at the head of the script that needs to be fixed depending upon the location of your Exchange server. What you need to do is copy in the correct property from what iCal expects to see as time zone information.
ical-tzid.png
You can find this information by selecting the time zone drop down menu in the upper right corner of your iCal window and select Other....
Once there find the location of your Exchange server and see what the resultant time zone information looks like in iCal. In my case, I live in California and my time zone is US/Pacific or America/Los_Angeles but the Exchange server in question lives in Dallas. So I set the property to US/Central.
Note: The ical_TZID property cannot have any spaces. Replace all spaces with underscores “_“. In iCal America/Los_Angeles will look like America/Los Angeles in the iCal dropdown menu.
I think I’ve built in the enough logic to grab any twisted time zone information out of the Exchange invite that Exchange can produce. If I’m wrong let me know.
Save the script and either set it up to run from a mail rule or as I do call it from the System AppleScript menu. You will need to save the script in ~/Library/Scripts/Applications/Mail/ folder. Create this folder if it doesn’t exist.
The script was not entirely my creation and credit also goes to others. I’m quite certain any errors are likely mine. 😉
If it works for you let me know. If it doesn’t work let me know that too and I’ll see if it can be fixed.
You will likely need a different copy of the script for each Exchange server that send you invites.
Update – 5 August 2008
To set the script up to run automatically you will need to create a new Mail rule as follows.

  1. Mail -> Preferences -> Rules -> Add Rule
  2. Description “Fix Exchange Invites”
  3. If “any” of the following conditions are met:
    • “Content-Class” “Contains” “urn:content-classes:calendarmessage”
      Note that the Content-Class header is not in the default list of headers on which you can set a rule action, but you can add it. This hint originally here.
    • “Any Attachment Name” “ends with” “.ics”
  4. Perform the following actions:
    • “Run AppleScript” “~/Library/Scripts/Applications/Mail/MailExchange2iCal-TZ-fix.scpt”
  5. Click “OK” and then “Apply”

Update – 11 August 2008
I found a glaring problem that I believe I’ve fixed. Apparently if the invite is only sent as an attachment the previous version of the script wouldn’t parse out the .ics attachment. This new version will. Please download it.
Update – 18 August 2008
I re-wrote the script making it better and more versatile. Please go to it’s new post home.

Comments

22 responses to “iCal – Exchange Time Zone Fix”

  1. sw Avatar

    thats great. I will try it tonight.

    Any ideas on how to solve the other way around ? I am trying to send invites to people using outlook 2003. Can this be done so that they will get an ICS file that will open in their cal ?

    Thanks!

    SW.

  2. Andy Avatar

    SW – anything’s possible. It’s hard for me to work in reverse as I really don’t send invites I just receive them. I’m quite certain a could write the script in reverse but I’m not sure if you can get a script to act on an outgoing message.

  3. sw Avatar

    Andy,

    I just recently (last week) switched to Mac and I must tell you that I am truly amazed that the apple folks have overlooked this issue. I am working in a Windows environment company, and I must say I am now embarrassed to admit to my colleagues the fact that I can no longer collaborate with them on our mutual invitations and meeting arrangement process.

    So Apple : How do you expect to be taken seriously as an corporate ready gear when you don’t provide support for the most fundamental functionality I can think of.

    It will take Apple developer about 2 hours to fix that (the only problem is a time issue, and an ICS attachment header missing if i understand this correctly). Why not do it now ! and I mean now !!!!

    We might want to setup a website and collect donations like the iPhone hack back in the day – for a software open-source that will sort that once and for all.

    Shai Wininger.

  4. Andy Avatar

    SW,

    Here’s the real problem. The current versions of iCal and iCal Server are CalDAV and iCalendar compliant. Only Outlook 2007 is said to be CalDAV and iCalendar compliant. Previous versions of Outlook are not compliant and don’t play well with other calendar applications. Here’s the actual time zone (TZID) spec and the spec for how it should be formatted. You can see by looking at it that the TZID that Outlook produces is non-compliant.

    A quick Google search shows an article or two that explain this very well.

    As such, you may need to re-assess where the fault for the lack of functionality lay. 😉

    Supposedly there are some 3rd party plugins to Outlook that will make it CalDAV-compliant.

  5. David Avatar

    I have to say, I’ve been sending and receiving invitations to/from iCal to Mac Entourage and Windows Outlook users on both Kerio’s Exchange-like server and Microsoft Exchange servers for at least two years. Under both Tiger and Leopard, I’ve never experienced any problems with the time zone being incorrect.

  6. Andy Avatar

    David, I’m pleased that you don’t have the difficulties others of us do. But, you are also using Microsoft products on both ends. Many of us are just using Mail and iCal. I would think that Entourage must do something to the Exchange invite to make it compatible. Just a thought.

  7. David Avatar

    You missed my main point. I AM using Mail and iCal. My colleagues are using Outlook and Entourage. On both invitations sent from my Mail/iCal through our Kerio mail server and invitations received from true Exchange servers, I have not experienced this problem–on either Tiger or on Leopard.

  8. Andy Avatar

    Mea culpa. I missed it.

    I do have to say that iCal is able to correctly interpret the invites I get from the hospital’s Exchange server. But it didn’t used to be that way. I honestly don’t know whether iCal got better at interpreting it or their Exchange server got updated and the TZID it sent out was better.

    Currently the TZID I get sent looks like Central Time (US & Canada). If you look at the reference in comment 4 above this doesn’t conform to the CalDAV spec. iCal would prefer something like US/Central or America/Los_Angeles or something like that. My script and others like it replace that TZID that Exchange sends and replaces it with a TZID that iCal likes, or can at least interpret.

    Again, I’m thrilled that you don’t have any difficulties but others do have problems; and I, and Justin, are just trying to provide what we think are easy solutions.

  9. Mickey Sattler Avatar

    The absolutely mind-boggling part of this problem is that while it happens to me, it doesn’t to my boss. Latest Mac OS X, Mail.app, and iCal. Same settings in prefs. Timezones for meetings originating in Boston are adjusted to PST for him, not for me. I have missed meetings; it’s become a running joke at the office.

  10. Mickey Sattler Avatar

    I wrote my comment just as I was downloading the script. I’ve read the ReadMe and am trying to find East Coast and West Coast co-workers to send me invites.

  11. Andy Avatar

    Mickey, the script will work only for each specific exchange server, or at least each exchange server in a unique time zone. You will need to use multiple copies of the script for each different exchange servers in a unique time zone. Does that make sense?

  12. Michael Jed Avatar

    I’ve been tearing my hair out over this bug in iCal since 10.5.x for a client. Waited thruOS X 10.5.1.2.3.4 updates. Finally I found this script today, modified it for Pacific EST (we’re in Australia) and it works!
    Everything was 10 hours (just happen to be 10+ hours GMT) out of place from certain Exchange servers, run the script directly from Mail and invite was added at correct time.
    Thanks!

  13. Matt Avatar

    How are you all connecting iCal to Exchange in the first place? I’m trying to use XCConnect from Xchange Network and I can update iCal and it goes to Outlook on a PC and then to Exchange, which is pretty good.

    My two tasks are:

    1) to be able to accept meetings from mail.app
    2) to be able to see free/busy for my work colleagues that use Windows/Outlook/Exchange.

    Any help/guidance would be greatly appreciated

  14. Andy Avatar

    Matt, we don’t connect iCal to Exchange. What we do is receive an Invite from Exchange via email and use the script to import it, with the correct time zone data, into iCal. The script should solve task 1, but isn’t going to help with task 2.

  15. Dan Avatar

    Hey Andy,
    I’ve just come here from Justins script blog.
    I initially tried using yours but had trouble with the mail rule firing correctly for new emails – as I mentioned on the other blog – If I manually apply the rule to ICS emails then it works fine – but thats not really a workable solution for me.
    Any ideas?
    Cheers,

  16. Andy Avatar

    Did the ‘Update’ I added to the end of my post help?

  17. Martin Avatar

    Quick question, I edited the script. Run it after selecting the message in mail, and yet nothing happens. No error, but I do NOT get the invitation moved to iCal, nor does it get automatically added…

    Any ideas? Thanks.

  18. Andy Avatar

    Martin, try re-downloading the script and try again. I was making some changes and you may have picked up a bum copy.

  19. Andy Avatar

    Dan, I may have found a solution I’d like you to try.