PowerShell - Import-Csv more objects

Hello,

I use this command for import a CSV:

import-csv c:\import3.csv -Delimiter ';' | foreach { new-mailcontact -alias $_.Alias -name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit domaine.com/architecture/utilisateurs/Contacts}

My CSV like that:

Name;DisplayName;EmailAddress;Alias

All is OK

Now i want import more informations for the contacts but i don't find the solution.

1) Where can i find all the objects possible to add in a contact list ?

2) I try that just for add the phone number but i have an invalidArgument

import-csv c:\import3.csv -Delimiter ';' | foreach { new-mailcontact -alias $_.Alias -name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -Phone $_.Phone -OrganizationalUnit domaine.com/architecture/utilisateurs/Contacts}

In my CSV:

Name;DisplayName;EmailAddress;Alias;Phone

July 29th, 2015 10:35am

Look at parameters that you can specify with New-MailContact cmdlet - https://technet.microsoft.com/en-us/library/Bb124519%28v=EXCHG.150%29.aspx
  • Marked as answer by Bartoch 16 hours 4 minutes ago
  • Unmarked as answer by Bartoch 11 minutes ago
  • Marked as answer by Bartoch 10 minutes ago
  • Unmarked as answer by Bartoch 10 minutes ago
Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 10:56am

Well There is no option to set telephone number for mail contact using exchange. also the -Phone switch is not a valid parameter

You can create mail contacts from CSV using the above command excluding -Phone $_.Phone

Later 

import-csv c:\import3.csv -delimiter ';' | foreach {set-contact -MobilePhone $_.phone}

  • Proposed as answer by Vishwanath.S 16 hours 31 minutes ago
  • Marked as answer by Bartoch 10 minutes ago
July 29th, 2015 11:00am

Thx a lot all but when i execute this command after i have a message.

Give the value identity :

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 11:28am

Try this

import-csv c:\import3.csv -delimiter ';' | foreach {set-contact -id $_.Alias -MobilePhone $_.phone}

  • Proposed as answer by Vishwanath.S 14 hours 58 minutes ago
  • Marked as answer by Bartoch 11 minutes ago
July 29th, 2015 12:33pm

It's near the solution but i have now the message:

"The command is finish but no parameter are modifie to the contact Tom Test"

My CSV:

Name;DisplayName;EmailAddress;Alias;MobilePhone
Tom Test;tomtest;ttestoli@test.com;ttejst;0232562321

I have try with -city $_.city and it's ok ! 

Tom Test;tomtest;ttestoli@test.com;ttejst;town

I supose the problem come from the format of the Phonenumber.


Free Windows Admin Tool Kit Click here and download it now
July 30th, 2015 2:40am

I have find my noob error.

I use in my CSV

Name;DisplayName;EmailAddress;Alias;MobilePhone

but i have forgot to write:

Name;DisplayName;EmailAddress;Alias;phone

Thx a lot Vishwanath.S

We have a good exemple here too:

http://davidvielmetter.com/tricks/bulk-create-external-email-contacts-in-exchangeoffice-365/

July 30th, 2015 3:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics