MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Improving the Outlook for Entourage

by Dale Dougherty
06/21/2002

Apple has changed its advertising strategy to feature users who have moved from a PC to Mac OS X. One person who ought to be featured prominently in the new ads is Paul Berkowitz, a classical pianist. However, it's not his musical abilities that should garner him more attention. In his spare time, Paul is an AppleScript developer trying to eliminate one of the major obstacles for PC users considering a move to Mac OS X: moving personal data from Windows Outlook to Entourage X.

I just made the move myself and while the adjustment to Mac OS X was minor for the most part, I had the expectation that moving from Outlook to Entourage would be easy, if for no other reason than that both popular programs are developed by Microsoft. I expected to find an import function in Entourage that would read Outlook's PST files directly. But I was surprised to learn that Entourage imports contacts from Outlook Express 5, Eudora, Netscape, Now Up-To-Date, Claris, and Palm, but not Outlook 2000. It does not import calendar data or notes from any of these programs. This certainly isn't going to help the average PC user who decides to switch to Mac OS X. (Over half the people in my group at O'Reilly have recently moved to Mac OS X from Windows machines--with the exception of one Linux user who made the move. Even more impressive, the new Mac OS X users bought the machines themselves.)

There is a workaround for the lack of Outlook-specific conversion utilities, exporting data from Outlook as tab-delimited fields in a text file. Then using Entourage's generic import tool, I created a mapping of Outlook fields into Entourage's equivalents. There are many mismatches: middle names are dropped, as are nicknames. If you ask Entourage to save everything it doesn't handle in the Notes field, you end up with garbage ("True" or "False", for instance). I tried this process twice with mixed results but I ended up having to live with this partial solution. Also, Entourage will only import contacts in this fashion.

It will not import calendar or task data. Importing email messages is less of a problem, if your email is on an Exchange server or you store your messages in an MBOX-format folder. Otherwise, the workaround for getting your old email messages out of Outlook is to copy your existing local email to a MAPI server and then download it to Entourage.

Paul Berkowitz's script package, Import-Export Entourage, can be downloaded from www.applescriptcentral.com. There is a $12.50 shareware fee. The scripts can be used to import and export 25 contacts only once each way for free as a demo.

One of the known problems with importing tab-delimited data is that some text strings are quoted during import. The workaround suggested by Microsoft's support site is to not use the export facility at all. Instead, it recommends that in Outlook you attach all of your contact information as Vcards (.vcf) and send them to your new account. Entourage, however, cannot import these Vcards as a batch. The user must open each card and click to add it to the Address Book. If your contacts number in the hundreds, this solution is obviously impractical.

I searched various newsgroups and Web sites through Google, after looking in vain on Mactopia. One name came up: Paul Berkowitz, who has developed a number of specialized AppleScripts for Entourage. I found a newsgroup posting that mentioned he was working on a set of export-import scripts for Entourage X based on work he had done for Entourage 2001. Just this week, Paul completed his work on V1.0 and released "Export-Import Entourage." It is an AppleScript package, available for download at www.applescriptcentral.com. I exchanged several email messages with Paul to learn more about his scripts. He told me:

"Basically, the scripts will export just about everything in Entourage to any other identity of Entourage (either version), to archive text files, and to Excel, and provide converters for exporting and importing a subset--Contacts, Calendar, Tasks, and Notes--to and from Outlook (all Windows versions and Outlook 2001 for Mac) and to other PIMs if they have Export/Import text file features."

He said that the scripts have taken him eight months to develop and "for the first and only time," he will make them available as shareware for $12.50. I asked him if he was surprised that Microsoft did not provide a conversion path for Outlook users. He defended the choices made by the Entourage team:

"The enormity of the operation made me realize that any sort of programming team--and the Microsoft Business Unit's Entourage sector at its Silicon Valley campus is really quite small, with just a few handfuls of programmers, program managers, and testers--would have to devote weeks or months to the effort, for something that people are most likely going to do only once. They do not have the luxury that the enormous Microsoft Outlook team has had to provide several kitchen sinks, so to speak.

Entourage X is still basically a v1.5 PIM outside its email functions, which are built on the already excellent Outlook Express Mac 5.0: Entourage is the best email program on any platform. The programming team had very short notice first to release Entourage 2001, then Entourage X, where they not only carbonized all code for Mac OS X but they also significantly improved the somewhat unfinished PIM features of 2001 in a very short space of time. I can well understand that it was much, much more important to devote the time to improving and fixing features people would be using every day than to a one-time transfer operation. Just look at the time it is taking them to produce the Palm conduits."

Dan Crevier of the Macintosh Business Unit (MBU) and Development Manager for Entourage said that they made a decision to choose the email clients and PIMs that were most important to their target users. "The set of clients we currently support were found to be the most common ones," he said, in email. "We did not find many users importing from Outlook to Entourage."

I find it hard to believe that there wasn't more interest in an easy Outlook-to-Entourage conversion path, given the dominance of Microsoft Office. It is certainly a path that most PC users will want to follow, and one can't help but feel that the MBU would be in conflict with Microsoft's greater mission to develop that path. Dan Gillmor encountered the problem and wrote about it earlier in the year. Most recently, Meg Hourihan faced the same frustrating problem as I did, and while she found her own imperfect solution, she commented "This took a very long time."

I don't fault Entourage as much as I do Outlook. Why is it so difficult to get my data out of Outlook so I can use it on another program? It's my data, and I need to transfer it and share it repeatedly. I want to share some of the data on the Web. I am able to move Word documents between my PC and my Mac OS X system. Why can't I transfer my personal data from one system to another? Don't lots of other people want to do this?

Related Reading

Office X for Macintosh: The Missing Manual
By Nan Barber, Tonya Engst, David Reynolds

I wish we had better standards in place (and companies willing to follow them) so that personal data was not locked inside the systems that manage it. As a user, open access to my data by multiple programs is far more important to me than access to the source of my programs. Microsoft benefits from locking me into Outlook, not me. Much of the magic of the Web is possible because HTML is an open format, however crusty, and other programs, not just browsers can access Web pages and add value (such as Google). Aside: Nike is running a series of bold, new commercials featuring Tiger Woods, who says his contract with Nike doesn't require him to use its equipment unless he finds it to be the best in the market. He says with amusement that it puts the pressure on Nike to be the best or else. If Microsoft is the best at what it does, then it shouldn't have to resort to this kind of lock-in of its contract with users. Let us choose the best.

I asked Paul if he had a sense that the underlying representation of the data in Entourage and Outlook was different and if that made the job of building this conversion package difficult. He said that the difference between the two data stores, which is at the heart of the problem, doesn't impact him because he's dealing with the text files created by Outlook's Export filter.

"It's not so much that they present the data in different ways, at least not in the user interface on the screen. In fact, Entourage must have borrowed Outlook's modes for calendar and tasks to quite an extent: users of one application will feel quite at home with the other. Basically, Entourage's presentation is more intuitive and attractive, while Outlook's is more complex and sophisticated. (I imagine that most Outlook users don't use one-twentieth of Outlook's power and probably would have to take a course in order to do so.) But the databases, which I have absolutely no direct access to, must be completely different and cannot speak to each other.

Historically, Microsoft's response to the debacle of Word 6 on the Mac, which was meant to be an exact version of Word 95 on Windows and was severely criticized by the Macintosh world for contravening Mac user guidelines, was to create the somewhat autonomous Macintosh Business Unit with the aim of giving Mac users a 'true Mac experience' in Microsoft products for the Mac. That decision was evidently carried out when developing Outlook Express Mac: although it looks like Outlook Express on Windows, it also owes some of its features to the earlier Mac-only application Claris Emailer.

Microsoft had the prescience to hire Jud Spencer, the progenitor of Emailer, after Apple discontinued it, and he and some of his team created OE Mac. Then Entourage was built on top of OE 5. So now that Entourage is coming to recreate many of Outlook's features on the Mac, it has done so by a completely different route. Certainly if Microsoft had instead just ported Outlook to the Mac, it would have been easier to transfer data from one to the other. But what we've got in Entourage is a beautiful, Mac-oriented application that could not have been arrived at by that route."

The Outlook database is a PST file on Windows. It contains all the messages, notes, tasks, and calendar events for a particular user. I tried moving that file to Mac OS X to see if Entourage could read it, which it can't.

Paul said that he "discovered that an Outlook programming team was able to make Windows PST files 100 percent portable to and from Outlook 2001 Mac," something he calls "an astounding achievement." So perhaps there is hope that Entourage will one day read PST files directly. Until then, you will have no choice but to export your personal information as tab-delimited or comma-separated (CSV) text files.

"CSV files are better to work with, once you figure you a way to deal with all the quotes they use for every field since they can incorporate internal carriage returns, tabs and commas. So that is what I use with my Outlook converters even though I use tab-delimited text files for importing and exporting to and from Entourage. The converters convert CSV to tabbed text, Windows encoding to Mac, and readjust all the Outlook fields to Entourage ones.

There are some 87 contact fields in Outlook 2000, 92 in Outlook XP, 78 in Outlook 97, 29 in Outlook Express Windows, and 60 or so in Entourage, only 40 or so of which are actually equivalent. (Incredibly, Outlook allows only 3 email addresses per contact, whereas Entourage permits 13). The fields are all called something else, and they're all in a different order. The scripts take care of all that, often with user options for custom field-mapping and the ability to save your choices so you never have to go through this again.

The scripts add any unmapped fields containing information to the Notes, properly labeled, on a per-item basis, without cluttering them up with empty fields. Similarly, they will set reminders for calendar events and tasks and transfer Outlook's more exotic fields that have no Entourage equivalent to the event and task Notes, so you don't lose any data. There are special options for mapping some calendar and task fields in non-English versions of Outlook since the fields are in an unknown alphabetical order in other languages. The scripts handle all that too.

The same CSV files that can be imported into Outlook can also be imported into the Yahoo calendar and Address Book and the Hotmail/MSN Calendar, so you can now synch an online calendar with your Entourage calendar if you wish. Other converters help with other PIMs such as Palm Desktop and with Excel.

Entourage itself is much less good about exporting and importing from text files than Outlook is: only contacts can be handled by a built-in feature, and this method loses categories, carriage returns and a few other things in the process. This is where my Entourage Export and Import scripts come in. The same scripts that import and export items to and from other identities in Entourage X and 2001 also do the same for the files converted by the Outlook Converter scripts. They can also provide the missing bits for contacts."

AppleScript in a Nutshell

Related Reading

AppleScript in a Nutshell
By Bruce W. Perry

Paul said that his scripts were made possible because "Entourage X has such a superb implementation of AppleScript, with a "model" object model." He said that scripting in Entourage 2001 was not completely finished and his earlier scripts required "contorted workarounds" to handle recurring events, reminders, and due dates.

"It was a real pleasure to see the great improvements in Entourage X. Entourage's AppleScript implementation was done by Dan Crevier, who has now taken over from Jud as Entourage's Development Manager. There are not many applications whose Big Boss is the AppleScript programmer, and it shows! I couldn't have done anything like these scripts in many applications. (It would be totally impossible in Palm Desktop, for example. I do have converter scripts in the package that work with PD's Import/Export features, however.)"

I asked Paul to share an example of what he liked about Entourage's implementation of AppleScript.

"There are some applications whose AppleScripting consists mostly of a long list of unique proprietary commands with unique names. You can never memorize more than a few of them and have to be continually looking them up. There's no particular logic to it. Excel is an example. Others may look all right, but don't work properly (that's worse): Word is an offending example.

Entourage's AppleScript dictionary consists mostly of "classes" -- objects, nouns -- with a few "events" -- verbs, mostly from the Standard Suite. The classes have elements, which in turn are other classes, all being items you access and are familiar with in the User Interface (on the screen). It's structured like a well-behaved tree with branches. Even some properties (such as 'category') are common to more than one class. Entourage also has a thorough implementation of 'whose' filters, which are much nicer to use than repeat loops everywhere.

For example, to get just future events of the Work category:

 set currentDate to current date
tell application "Microsoft Entourage"
    set selectedEvents to every event where its category contains 
    {category "Work"} and its start time is greater than currentDate
end tell

That's a lot nicer than:

set selectedEvents to {}
set currentDate to current date
tell application "Microsoft Entourage"
	
    set allEvents to (every event)
    repeat with i from 1 to (count allEvents)
		
        set theEvent to item i of allEvents
        if category of theEvent contains {category "Work"} and 
        start time of theEvent is greater than currentDate then
			
            set end of selectedEvents to theEvent
        end if
    end repeat
end tell

(But don't try the first example in Entourage 2001 because 'where its' had not been implemented there for 'category'.) You might have only 20 future events in your calendar and only 10 of them Work-related, but the second version still has to slog through all 2000 past events in your identity. There are still a few things you can do on the screen, especially in the Calendar, that you can't yet do in AppleScript (such as selecting an event). But, by and large, you can not only do almost everything else by AppleScript, but even many things that are impossible to do in the UI. These Export-Import scripts do not, of course, do fancy tricks but just extract and recreate it. The thorough-going nature of the AppleScript implementation allows replicas to be recreated in the importing identity: if important properties weren't scriptable, you couldn't do it."

When I contacted Paul originally, I thought this AppleScript hotshot was a student. It turns out he is a professor, teaching piano at the University of California, Santa Barbara.

"I've only had a computer for about five years (the university finally insisted I have one, although I refused one when I first arrived). I migrated to Outlook Express Mac about three years ago (fed up with Eudora Lite) and thence to Entourage when I was invited to be a beta tester. At about the same time I moved to OE, I also discovered AppleScript, which I really took to. In my teens I had really liked math and logic, but I had given all that up to pursue music. AppleScript seemed like an intricate game to me-- it's sort of what doing complex crossword puzzles are for other people.

Most of my scripts (almost 200 now) were dreamed up as solutions to the puzzles posed by people on mailing lists or newsgroups--"Why can't I do something or other in Entourage?" It's the follow-through that takes time--I like to make my scripts very professional, with lots of options."

However, he says that he uses very few of his own scripts on a regular basis. (So much for Paul Berkowitz scratching his own itch, a la open source development.)

"As far as Export-Import Entourage goes, I have very little use for it myself. Now and again I do want to transfer data from my desktop to my iBook (both running Entourage X). I don't even have a Windows PC, but I got Virtual PC some time ago when I wanted to figure out how to port just contacts from Outlook. (Microsoft sent me a free copy of Office Windows so I could play with it.) Ever since then, I'd had in the back of my mind the project to transfer the calendar--I knew it could be done.

When Entourage X was released without Palm synching last October, I came up with some workaround scripts for synching Entourage X to Entourage 2001. That's when I got really ambitious and decided I'd write scripts to transfer everything. From there it was a short step (so I thought) to writing converters specifically for Outlook, since there seemed to be masses and masses of new Mac OS X and Office X users looking for a way to migrate from Outlook Windows, and other converters for Excel. The Excel method proved too complicated for export/import from other applications, so I came up with a few more converters. What I thought would be a major effort of perhaps two months (rather than my usual scripts, which might take a few days to polish) expanded into this monster project of 50 scripts for each of Entourage X and 2001, and has taken no less than eight months to complete. There's somewhere between 60,000 and 70,000 lines of code in all."

Dan Crevier says that he is "very impressed" by Paul's work. Paul has been a beta tester for Entourage. "We've used his feedback to help prioritize our scripting work to enable as many scenarios as possible," said Dan. "I feel that our effort here has really paid off. Instead of implementing a bunch of custom code to import from every possible application out there, we've made it possible for people to write scripts to import from any current or future clients. AppleScript opens up a world of possibilities."

I'm looking forward to trying Paul's scripts and see if I can have a cleaner import of Outlook data into Entourage. I also think that the ability to export personal data from Entourage will be useful as well. Another route I am exploring is syncing data up with my iPAQ, Pocket PC. I'll write about that process in a future article. I don't want to give up my iPAQ when moving to OS X.

So, PC users moving to Mac OS X have Paul Berkowitz to thank for helping them port their personal data to a new platform. Apple and Microsoft should also be thankful, as well as a little embarrassed that they are relying on an individual developer to make up for their own shortcomings. Nonetheless, Paul's work also demonstrates the power of AppleScript.

Dale Dougherty is the editor and publisher of MAKE, and general manager of the Maker Media division of O'Reilly Media, Inc.


Return to the Mac DevCenter.

Copyright © 2009 O'Reilly Media, Inc.