none
Importing External mail contacts in to Exchange 2007 RRS feed

  • Question

  • Hi There,

     

    We have few hundreds of external mail contacts which needs to be imported in to our Exchange 2007 org for the users to send the mail to those cotacts...my question is whether these contacts first needs to be imported in to AD and mail enable them using exchange 2007 or we can directly import them in to exchange and mail enable them...please help me get some solution...

     

    thanks

    thams

    Saturday, July 12, 2008 9:32 AM

Answers

  • Hello,

     

    You can import mail contacts from CSV file to AD with EMS in bulk. I assume that you have below column in your CSV file.


    DisplayName,EmailAddress


    EMS command to import mail contacts into MailContacts OU:


    Import-Csv Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "MailContacts" }

     

    Reference: New-MailContact

    Saturday, July 12, 2008 10:11 AM
  • Here’re also some references which can help you:

    How to use Csvde to import contacts and user objects into Active Directory

    http://support.microsoft.com/kb/327620/en-us

     

    Cmdlet: export contact to csv file <csvde –r objectclass=contact –f c:\contact.csv>

    Notes: It can let you know the attributes which require for buildup a contact. The best way to let CSVDE work is to export existing data from a contact, then use that output to help you making input file.

    Monday, July 14, 2008 10:27 AM

All replies

  • Hello,

     

    You can import mail contacts from CSV file to AD with EMS in bulk. I assume that you have below column in your CSV file.


    DisplayName,EmailAddress


    EMS command to import mail contacts into MailContacts OU:


    Import-Csv Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "MailContacts" }

     

    Reference: New-MailContact

    Saturday, July 12, 2008 10:11 AM
  • Here’re also some references which can help you:

    How to use Csvde to import contacts and user objects into Active Directory

    http://support.microsoft.com/kb/327620/en-us

     

    Cmdlet: export contact to csv file <csvde –r objectclass=contact –f c:\contact.csv>

    Notes: It can let you know the attributes which require for buildup a contact. The best way to let CSVDE work is to export existing data from a contact, then use that output to help you making input file.

    Monday, July 14, 2008 10:27 AM
  • hi, i have the same issue and i thought this was the answer however when i use the command i get an error saying that organizatonal unit MailContacts cannot be found and that i should check the spelling and try again.
    in the exchange management console the contacts OU is called "Mail Contact" so i tried that but got the same message.

    any ideas why?

    Friday, December 12, 2008 12:09 PM
  • Hi Dave,

    As you said that you have an OU called "Mail Contact" so you have to use "Mail Contact" (with a sapce in between) in the command instead of MailContact.

    OU name MailContact is just an example in the command it should be changed with the OU name you have in your environment.
    Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
    Friday, December 12, 2008 1:00 PM
  • yes, i tried that but got the same message.

    is the display name of the OU different to the actual name.
    in other words on the left hand side of the exchange management console it is called "Mail Contact" is this the actual name or just a display name.
    (does that make any sense?)


    is it case sensertive?
    Friday, December 12, 2008 1:18 PM
  • here is the message...

    command entered...
    Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Mail Contact" }


    Organizational unit "Mail Contact" was not found. Please make sure you have typed it correctly.
    At line:1 char:40+ Import-Csv C:\Contacts.csv | ForEach { N <<<< ew-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Mail Contact" }

    there is one of these messages for each line in the .csv file.

    also does the csv file need to have the colum headers?

    Friday, December 12, 2008 1:24 PM
  • Are you checking correct title/heading of the "Mail Contact" column in EMC? "Mail Contact" is the recipient type detail also... You need to find the title/heading with name Organizational Unit in EMC or just give any OU name which exists in your AD structure.  You can check the correct OU name in Active Directory Users & Computer on any of the domain controller or you may create a new OU.

    If you have multiple OUs with same name then you can give it in below format "Domain.com/Mail Contacts" also...

    Yes CSV file requires header like below.
    displayname, emailaddress
    Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
    Friday, December 12, 2008 1:38 PM
  • ok, cracked it :)

    one more thing, if i want to also hide these from the exchange address list is there another colum i can add to the csv file?

    if so what do i need to add to the command to bulk import them?
    Friday, December 12, 2008 2:03 PM
  • Same way you can run Set-MailContact cmdlet to hide those....

    Import-Csv Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -HiddenFromAddressListsEnabled $true}

    Hope this helps...!!!

    Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
    Friday, December 12, 2008 2:52 PM
  • your a star!

    thanks sooo much :)
    Friday, December 12, 2008 3:22 PM
  • Nice comment... :)
    Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
    Friday, December 12, 2008 3:31 PM
  • Thanks :)

    I do however have another little problem.

    The powers at be have decided they don’t want these contacts to be in the global address list.
    We are a school and they are afraid that sensitive emails will be sent out kids by mistake.

    Is it possible to have a sub set of addresses, or import them directly into another address list somehow?

     

    Tuesday, December 16, 2008 11:27 AM
  • oh and another one (well several)...

    when i run this command...

    Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -HiddenFromAddressListsEnabled $true -OrganizationalUnit "Domain.local/MailContacts" }

    to import the .csv file and set the flag to not show in the address list i get the following...

    New-MailContact : A parameter cannot be found that matches parameter name 'HiddenFromAddressListsEnabled'.At line:1 char:145


    and i have just noticed after i sucsessfully importing the contacts (or some as a test) with the following...

    Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Domain.local/MailContacts" }

    when i look in the properties of the contacts there is no tick box to say hide from address list.

    i have worked out how to add the contacts into a new address list in exchange but i cannot get that address list to display in outlook on the client computers.

    thanks for your continued help :)


    Tuesday, December 16, 2008 12:49 PM
  • Hi Dave,

     

    Sorry for the delay…

     

    Well, you need to run set-mailcontact command to hide the address from GAL because that option is not available in New-MailContact command.

     

    Import-Csv C:\Contacts.csv | ForEach {

    New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Domain.local/MailContacts"

    Set-MailContact -Name $_.DisplayName -HiddenFromAddressListsEnabled $true

    }

     

    If contacts are already created then you need to just run the command I have given earlier to hide from GAL.

    Import-Csv Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -HiddenFromAddressListsEnabled $true}

     

    Well workaround for the your situation, when students sends email to outside users by mistake, you can create a DL named “StudentDL”,  add all students into it and set restriction on all the mail contacts which you created to reject message when it came from the member of student DL.

     

    Import-Csv Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -RejectMessagesFromDLMembers “StudentsDL” }

     

    I would suggest you to test this workaround by adding your ID into StudentDL temporary and send a mail to any of the contact from above… :)

     

    Keep in mind that, the things you set here, may take upto couple of hours to make effective due to information store services cache.

    Wednesday, December 17, 2008 4:05 PM
  •  

    When I run the combined import and hide command I get the following...

    New-MailContact : Cannot bind parameter because parameter 'Name' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".

    At line:1 char:187+ Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "stwilfrid.local/MailContacts" Set-MailContact -Name  <<<< $_.DisplayName -HiddenFromAddressListsEnabled $true }

    When I import the users using the command previously given then try to use your command to hide them from the GAL i get the following...

    Command in:

    Import-Csv C:\Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -HiddenFromAddressListsEnabled $true}

     

    Outpot:

    cmdlet Set-MailContact at command pipeline position 1

    Supply values for the following parameters:

    Identity:

    It then has a cursor for me to enter a value? If I type the Alias of a user it seems to accept it and then asks for another. (and successfully hides that alias fron the GAL)

    I assume the identity its asking for is in fact the Alias?

     

    If so is it just a case of adding an “Alias” Colum to the CSV and inserting a parameter to point to it?

    Would the extra part just be...

    “-Alias –$_.Alias”

    Making the full command...

    Import-Csv C:\Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -Alias $_.Alias -HiddenFromAddressListsEnabled $true}

     

    Also I think you miss understand the accidental email thing. Staff need to be able to email students but people are worried that confidential emails will be sent to them by mistake. To solve this they want a second address list for students totally separate from the GAL.

    Is that possible?

    Thursday, December 18, 2008 10:03 AM
  • hi there, can anyone help with the above?
    Friday, January 9, 2009 9:18 AM


  • Hi,

    i got the same error and After 2 days of searching the here is my working run Syntax:

    Import-Csv Contacts.csv | ForEach-Object -Process { New-MailContact -Name $_.DisplayName -External
    EmailAddress $_.EmailAddress -OrganizationalUnit "MailContacts" -Alias $_.DisplayName | Set-MailContact -HiddenFr
    omAddressListsEnabled $true; }

    Enjoy
    Thursday, June 4, 2009 10:03 PM
  • Hi All,

    has anyone tried to import the external contacts and create a distribution group for the imported contacts? using the command let

     

    Thanks

    Thursday, January 13, 2011 1:39 AM
  • Hi All,

    has anyone tried to import the external contacts and create a distribution group for the imported contacts? using the command let

     

    Thanks

    Hi

    I have imported Mail Contacts and now i want to add telephone NUmber, Country, City, POsition, Company for the added Mail Contacts, can anyone help me on the same.

    Thursday, June 7, 2012 12:46 PM
  • Is this one column only for DisplayName,EmailAddress  (A1) ? Then do I put in each Name,emailaddress only separated by a comma in the one column?
    Thursday, August 8, 2019 2:04 PM