Skip to content
Raphaël Doursenaud edited this page Sep 6, 2016 · 1 revision

Prerequisites

The script uses the the Domain Shared Contacts API, which is only available to Google Apps Premier and Education Editions domains. To enable the API, log in to your admin account, and click the User accounts tab. Then click the Settings subtab, select the checkbox to enable the Provisioning API and save your changes. Please note changes can take up to 24 hours to be reflected in the email address auto-complete and the contact manager.

Importing Microsoft Outlook contacts into the shared contact list of a domain

  1. Export your Microsoft Outlook contacts to CSV file in Windows format.
  2. Install the script and its dependencies.
  3. Run the script with:
    cd google-shared-contacts-client
python shared_contacts_profiles.py --admin=*[email protected]* --import=*your-ms-outlook-contacts-file.csv* --output=*output-file.csv*

OR (only Windows, using Win32 release)

cd google-shared-contacts-client
shared_contacts_profiles.exe --admin=*[email protected]* --import=*your-ms-outlook-contacts-file.csv* --output=*output-file.csv*

The script will launch your default browser and ask for authorization.

Note that the script will print the contacts before and after the loading of contacts. The contacts should be viewable in the Contact Manager within 24 hours, at this address: http://www.google.com/contacts/a/your-domain.com

The output file will contain all added or updated contacts with their ID, so that you can later update or delete them. The output format is suitable for input to another invocation.

Imported CSV file format

The Zip file includes an example file: outlook.csv.

The file is a comma-separated CSV file. The first line should contain the name of each column. Accepted columns are:

  • Action: the action to perform on the contact, as one of: add, update, delete.
  • ID: the ID of the contact; must be left empty for add action, set for update and delete actions. You can retrieve contact IDs from the output of an --import or --export command.
  • contact fields: full list of accepted fields.

Example:

Action,ID,Name,E-mail Address,Business Phone
add,,Adam Glacius,[email protected],+1 555 3227 8543
update,241a444f0b330b22,Daniel Ireland,[email protected],+1 555 3227 8544
delete,527fbda08922b018,Duncan Amey,[email protected],+1 555 3227 8545

Other features

The script also enables you to:

  • export the existing contacts to a CSV file, with --export=exported-file.csv
    Please note that not all fields are supported by this feature: only the first home/work/other email addresses/phone numbers/postal addresses are retained. We recommend not using this feature to synchronize your address list back to your Outlook repository.
  • delete all contacts, with: --clear

If you specify several commands at the same time, they are executed in the following order: --clear, --import, --export regardless of the order of the parameters in the command line. In particular:

  • --clear is executed first because it asks for confirmation. If you specify --clear with another command, the script is guaranteed to execute without interruption after --clear prompt.
  • If you specify --clear --export, all contacts are deleted first, hence --export generates an empty file.
  • If you specify --import --export, the new contacts are imported first, then --export generates a file containing all contacts of the domain including the new ones.

Example invocations

Imports the contacts of your-ms-outlook-contacts-file.csv into the domain. Writes the added or updated contacts to output-file.csv:

python shared_contacts_profiles.py [email protected] --import=your-ms-outlook-contacts-file.csv --output=output-file.csv

Exports all contacts of the domain to export-file.csv:

python shared_contacts_profiles.py [email protected] --export=export-file.csv

Deletes all contacts of the domain:

python shared_contacts_profiles.py [email protected] --clear