Skip to content

Rollin with My GAL

December 11, 2012

We have been looking everywhere for a solution in Office 365 that will allow for a contact list with the following properties:

  • Can be shared and edited by all people in the organization.
  • Can be added to everyone’s address list.
  • Allows for Contact Groups or DLs to be created.

According to Microsoft themselves, this is impossible. However, you can get most of this using the GAL. It isn’t editable by everyone (and not at all using Outlook), but it was a worthwhile compromise. However, getting all of your old contacts into the GAL can be a bit of a pain. The simplest way is to export your existing contacts list to a CSV file and import it using a PowerShell script. Except… no one seems to be willing to share a PowerShell script which can handle empty fields in the CSV as well as add extra email addresses if they exist in the CSV – until now.

The link below is my own PowerShell script that takes as input a CSV file with every field I could imagine importing for External Contacts. If you have another field to add, it may or may not be available in one of two commands:

Set-Contact: http://technet.microsoft.com/en-us/library/bb124535.aspx
or
Set-MailContact: http://technet.microsoft.com/en-us/library/aa995950.aspx

Add or remove fields as you’d like from the CSV and the script. Just be sure to use the same syntax in the script to make sure the field has a value, then have it added to the HashTable that builds the list of parameters for each command.

NOTE: Make SURE your alias field is free of unusual characters. The alias field only accepts a-z, A-Z, 0-9, !, -, _, ‘, `, {, |, }, #, %, $, *, and ^. It does not accept non-US characters (accents and whatnot). This stopped my script more than a few times.

Script and Example CSV: https://www.sugarsync.com/pf/D9497231_154_753921586

New Note: After the Office 365 upgrade (to the “new” Offce 365 – which is really Exchange 2013), you must add the -ForceUpgrade option to any calls to Set-Contact if the contacts were created pre-upgrade. This won’t apply for these imports, but I felt it was a useful tip.

Advertisements

From → Uncategorized

6 Comments
  1. taylor permalink

    Great post helped me out a ton I was having issues with blank fields in the csv

  2. Great script, helped me out a ton!

  3. Justin permalink

    We did an export of out contacts from a shared O365 mailbox to a CSV… weird thing is is I am not seeing the alias column

    • Contacts which are stored in mailboxes are different than those in the Global Address List. Aliases are not required for mailbox-stored contacts but they are required for External Contacts stored in the GAL. I created them manually by combining the first and last names of the contacts. There were some duplicates that I had to handle manually.

  4. Script is looking good :-)

    But i have a question

    What is the format that will also create contact groups, not just the individual contacts?
    I need to import all the parents of school in different distribution groups.

    Like “Parents group 3A”

    And i have already created de the groups. (But i can delete them when neede)

    What i’m looking for is to import all the parent and add them to the right groups.
    But with the possibilty to change the groups with the new school year.

    I found information on this page http://technet.microsoft.com/en-us/library/bb124340(v=exchg.150).aspx

    Add-DistributionGroupMember -Identity “Staff” -Member “JohnEvans@contoso.com”

    But i don’t understand to add it to the script or CSV

    Can you help me?

    Best Regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: