Importing contacts from a CSV file into a Contact Group in a Shared Mailbox.

Copper Contributor

Hi.

I have a csv file that has the information of 90+ contacts. I have attached the format of the csv file with a dummy entry.

These contacts are required to be imported into a Contact Group in a Shared Mailbox.

I have run the following powershell import command.

 

Import-ContactList -CSV -CSVData ([System.IO.File]::ReadAllBytes("D:\Users\Administrator\Desktop\TerryAdams.csv")) -DateCultureName "en-GB" -Identity terrya@contoso.edu

 

This command imports the contacts to 'My Contact' in outlook. Although I can see the Contact Group I need to move them to I am struggling to find a way.

 

If anyone out there has been successful with doing this or has a way to get round the issue I would like to know.

 

Thanks.

9 Replies
Hi @gablake

If these contacts were meant to be shared within the organisation, would you not simply import them into Exchange Online as external contacts so they appear in the GAL?

https://o365info.com/bulk-import-contacts-to-exchange-online-office-365-using-powershell-part-1-of-2...

Any reason specifically for the contacts going into a shared mailbox? What would you like to achieve?

Best, Chris

Hi Chris.

The Contact Group in the Shared Mailbox was deleted and can not be recovered. Only certain users have been given access to this Shared Mailbox.

So I am wanting to create the orginal mailbox. I have created the Contact Group I just need to populate it with the contacts from the csv file. If it wasn't for so many contacts I would do it manually.

 

Thanks for reaching out.

Ah, I see, it is restoring what was in place.

In that case you should be able to do it by creating and giving yourself full access to the shared mailbox, opening it in your Outlook so it's alongside your mailbox. Import the contacts into the shared mailbox via Powershell and then create the contact group after the import. If you have an issue doing this I would consider temporarily converting the mailbox to a regular mailbox with credentials and then Powershelling the CSV directly into the mailbox, where again you can then create the contact group in your Outlook.

Others may have some other methods here based on their experience.

Best, Chris

If you want to programmatically create a Contact group, you will have to use the EWS API, "pure" PowerShell doesn't have such functionality.

Hi Vasil.

 

Creating the Contact Group is not the issue. What I am trying to achieve is to import the contacts from a csv file into the Contact Group.

Not sure if you have a scipt or a way forward to be able to achieve this.

 

Thanks.

Still the same answer, you have to use EWS. PowerShell on itself doesn't deal with item-level operations when it comes to Exchange Online, with few minor exceptions. Glen's Contacts module should be able to do it: https://github.com/gscales/Powershell-Scripts/tree/master/EWSContacts

You could create a new contacts folder, import the CSV to that folder, open the contacts group, add members>from Outlook contacts>select the new contacts folder>bulk select all contacts>click on the "Members" button>OK

 

All these steps are done in Outlook for PC.

My assumption is that the author wants to do this programmatically.

He said "If it wasn't for so many contacts I would do it manually.", so it doesn't look to me like he really cares how he does it as long as it's not too time consuming or labour intensive.