tags:

views:

1271

answers:

3

Hi,

We currently have a specific format for how our email addresses are defined, based upon name. This system originated some time ago and is beginning to become a bit of a hindrance.

We would like to move to a new format, based along the line of

<first name initial><second name initial><last name>@organisation.com

However, we dont just want to rename the mailboxes etc, instead we're opting to keep the existing email addresses for all current users, but using the new form for new users. In addition, we want to add a mail alias to all of the mailboxes using the legacy format.

Can anyone suggest a relatively straight-forward way to add these aliases via code? Pulling the user's name details is not an issue, moreso just adding the alias to the mailbox. We're currently running exchange 2003 for most users, but are on the verge of a 2007 migration, and so have the odd user on 2007 also (the two servers are running side by side at present).

I've read that all exchange 2007 management should be done using the 2007 tools and not active directory as was previously the case, so can all of this be performed via the exchange 2007 APIs, even for 2003 "legacy mailboxes" (as termed in exchange)?

Basically I'm just looking for a good direction to go here; I've never really done any coding for exchange. Thanks!

+1  A: 

Here's a MS KB that describes modifying the alias through extended MAPI. It looks like you'll need the Exchange Developers Kit to do this.

http://support.microsoft.com/kb/183249

David Yu
A: 

In the end I found Powershell was by far the easieast way to go. Here is a skeleton of the script I ended up using showing how to add an additional address to each mailbox:

$mailboxes = get-mailbox | sort Name

foreach($mailbox in $mailboxes)
{
    ...
    # Logic for working out the new address
    ...

    $mailbox.EmailAddresses += $newAddress
    $mailbox | set-mailbox
}

And for completeness, this script was run on the new Exchange 2007 server. My initial concern with adding the addresses to mailboxes residing on the older 2003 server was a non-issue; the legacy mailboxes were updated too.

CapBBeard
+1  A: 

I'm posting this after the question was answered, but is there any reason you didn't just use the recipient policies?

Dayton Brown
Basically just being unfamiliar with exchange features is the main reason. I'm also more comfortable scripting, haha :) I'd probably still use the script; it wasn't particularly difficult.
CapBBeard