Calendar and Contacts Migration
If your mail migration strategy doesn't cover contacts and calendar, you can import via the REST (REpresentational State Transfer)  interface. (Currently, contacts and calendar are only imported with the Exchange migration tool and the PST Import Wizard, so this applies to most IMAP migrations).
Migrating with REST
The basic procedure is this:
- Export calendar or contact data from your existing server into a csv or ics file
- Migrate that data file to a host that can access the zimbra server
- Use the REST interface to insert the data into Zimbra
Today, within the Zimbra Collaboration Suite we have a number of different server-side URLs that our client accesses to download an attachment, export contacts as CSV, export a calendar as an ICS, file etc. We are also adding sharing (what would collaboration be without sharing, after all) of calendars, contacts, etc. Not only within a particular Zimbra community, but between Zimbra communities and the public at large.
In order to facilitate this, we are coming up with a clean, consistent URL interface to all our resources. The best way to describe this is with some examples.
Lets say I want access to my calendar folder from within iCal. The URL would look like:
The default format on calendar folders is ICS, so no need to specify the format.
Lets say I want to export my contacts folder so I can import them into another account:
Contact folders have a default type of CSV, so like calendars, no need to specify the format.
How about an RSS feed of unread messages in my inbox:
By specifying an extension of ".rss" on the inbox folder, the server will automatically generate an RSS feed on it. Adding the "query" parameter lets me further refine what gets returned. You can also specify "?fmt=rss" instead of using the ".rss" extension if you'd like. You can also use the encoding for double quotes, %22 (For example, inbox.rss?query=%22is:unread%22)
Lets do something a little more interesting. How about a zip file containing all messages in my talks/ajax folder:
The server zips them all up and returns the zip file.
Another interesting example is say you have created a public calendar that you want to share with everyone. Once you have granted access to the calendar, it is up to the consumer to chose what format they want to view it in:
http://server/zimbra/user/roland/calendar/talks.ics http://server/zimbra/user/roland/calendar/talks.html?view=month http://server/zimbra/user/roland/calendar/talks.atom http://server/zimbra/user/roland/calendar/talks.xml http://server/zimbra/user/roland/calendar/talks.txt
How about accessing another user's calendar/folder? Once they grant you access, you can use the same exact syntax:
One last interesting example to leave you with. Lets say you have a friend at widgets.com who you know is running Zimbra and who has shared their calendar with you, but you don't know the name of their public Zimbra server. As long as they publish some DNS SRV records for _zimbra._tcp.widgets.com, then you can access it directly from your Zimbra without needing to know his server's address:
This last format (email@example.com) is also necessary when accessing resources in a non-default domain on your local Zimbra server.
REST file formats
see this reference page: REST File Formats
Importing into Zimbra
We've added the ability to update/create content by POST'ing content to REST urls. GETs continue to remain read only, with no side-effects (as they should be).
For example, you can POST an RFC822 formatted message to your inbox REST url to append messages to the inbox folder. Using the popular curl program, this would look like the following:
curl -u schemers:password --data-binary @/tmp/rfc822.txt https://server/service/home/schemers/inbox
Note, you currently have to use /service/home for POSTs instead of /zimbra/home, because /zimbra/home issues a redirect, which isn't allowed with POSTs. We'll be fixing that in an upcoming release.
Other items that can be updated this way are calendar appointments (ICS), and contacts (csv and the new vcf (vCard) format):
curl -u username:password --data-binary @/tmp/new.csv http://server/service/home/username/contacts?fmt=csv
curl -u username:password --data-binary @/tmp/new.ics http://server/service/home/username/calendar?fmt=ics
curl -u username:password --data-binary @/tmp/new.vcf http://server/service/home/username/contacts?fmt=vcf
The full user name (firstname.lastname@example.org) is required when importing to resources on a non-default domain on your local Zimbra server.
NOTE - this works for resource accounts as well.
The target "contacts" in the above command corresponds to the actual folder name on the Zimbra server, rather than a service. This means that you can import to user-defined folders by specifying the appropriate target name in the command. If you have created a folder named "SharedContacts", for example, the command to import into this folder would be
curl -u username:password --data-binary @/tmp/new.csv http://server/service/home/username/sharedcontacts?fmt=csv
On later version's (such as 5.0.10+) instead of --data-binary, you should use --upload-file.
curl --insecure -u admin:password --upload-file /tmp/test.csv https://email@example.com/contacts?fmt=csv
Alternatively, you can use zmmailbox pru:
zmmailbox -z -m firstname.lastname@example.org pru /Contacts /tmp/test.csv