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

%3CLINGO-SUB%20id%3D%22lingo-sub-324284%22%20slang%3D%22en-US%22%3EImporting%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324284%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%3C%2FP%3E%3CP%3EI%20have%20a%20csv%20file%20that%20has%20the%20information%20of%2090%2B%20contacts.%20I%20have%20attached%20the%20format%20of%20the%20csv%20file%20with%20a%20dummy%20entry.%3C%2FP%3E%3CP%3EThese%20contacts%20are%20required%20to%20be%20imported%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FP%3E%3CP%3EI%20have%20run%20the%20following%20powershell%20import%20command.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImport-ContactList%20-CSV%20-CSVData%20(%5BSystem.IO.File%5D%3A%3AReadAllBytes(%22D%3A%5CUsers%5CAdministrator%5CDesktop%5CTerryAdams.csv%22))%20-DateCultureName%20%22en-GB%22%20-Identity%20terrya%40contoso.edu%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20command%20imports%20the%20contacts%20to%20'My%20Contact'%20in%20outlook.%20Although%20I%20can%20see%20the%20Contact%20Group%20I%20need%20to%20move%20them%20to%20I%20am%20struggling%20to%20find%20a%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20anyone%20out%20there%20has%20been%20successful%20with%20doing%20this%20or%20has%20a%20way%20to%20get%20round%20the%20issue%20I%20would%20like%20to%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-324284%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-326701%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-326701%22%20slang%3D%22en-US%22%3E%3CP%3EHe%20said%20%22%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20font-family%3A%20'SegoeUI'%2C'Lato'%2C'Helvetica%20Neue'%2CHelvetica%2CArial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EIf%20it%20wasn't%20for%20so%20many%20contacts%20I%20would%20do%20it%20manually.%3C%2FSPAN%3E%22%2C%20so%20it%20doesn't%20look%20to%20me%20like%20he%20really%20cares%20how%20he%20does%20it%20as%20long%20as%20it's%20not%20too%20time%20consuming%20or%20labour%20intensive.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-326691%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-326691%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20assumption%20is%20that%20the%20author%20wants%20to%20do%20this%20programmatically.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-326465%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-326465%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20could%20create%20a%20new%20contacts%20folder%2C%20import%20the%20CSV%20to%20that%20folder%2C%20open%20the%20contacts%20group%2C%20add%20members%26gt%3Bfrom%20Outlook%20contacts%26gt%3Bselect%20the%20new%20contacts%20folder%26gt%3Bbulk%20select%20all%20contacts%26gt%3Bclick%20on%20the%20%22Members%22%20button%26gt%3BOK%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20these%20steps%20are%20done%20in%20Outlook%20for%20PC.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-325833%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-325833%22%20slang%3D%22en-US%22%3E%3CP%3EStill%20the%20same%20answer%2C%20you%20have%20to%20use%20EWS.%20PowerShell%20on%20itself%20doesn't%20deal%20with%20item-level%20operations%20when%20it%20comes%20to%20Exchange%20Online%2C%20with%20few%20minor%20exceptions.%20Glen's%20Contacts%20module%20should%20be%20able%20to%20do%20it%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgscales%2FPowershell-Scripts%2Ftree%2Fmaster%2FEWSContacts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fgscales%2FPowershell-Scripts%2Ftree%2Fmaster%2FEWSContacts%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-325568%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-325568%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Vasil.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECreating%20the%20Contact%20Group%20is%20not%20the%20issue.%20What%20I%20am%20trying%20to%20achieve%20is%20to%20import%20the%20contacts%20from%20a%20csv%20file%20into%20the%20Contact%20Group.%3C%2FP%3E%3CP%3ENot%20sure%20if%20you%20have%20a%20scipt%20or%20a%20way%20forward%20to%20be%20able%20to%20achieve%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324459%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324459%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20want%20to%20programmatically%20create%20a%20Contact%20group%2C%20you%20will%20have%20to%20use%20the%20EWS%20API%2C%20%22pure%22%20PowerShell%20doesn't%20have%20such%20functionality.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324387%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324387%22%20slang%3D%22en-US%22%3EAh%2C%20I%20see%2C%20it%20is%20restoring%20what%20was%20in%20place.%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20that%20case%20you%20should%20be%20able%20to%20do%20it%20by%20creating%20and%20giving%20yourself%20full%20access%20to%20the%20shared%20mailbox%2C%20opening%20it%20in%20your%20Outlook%20so%20it's%20alongside%20your%20mailbox.%20Import%20the%20contacts%20into%20the%20shared%20mailbox%20via%20Powershell%20and%20then%20create%20the%20contact%20group%20after%20the%20import.%20If%20you%20have%20an%20issue%20doing%20this%20I%20would%20consider%20temporarily%20converting%20the%20mailbox%20to%20a%20regular%20mailbox%20with%20credentials%20and%20then%20Powershelling%20the%20CSV%20directly%20into%20the%20mailbox%2C%20where%20again%20you%20can%20then%20create%20the%20contact%20group%20in%20your%20Outlook.%3CBR%20%2F%3E%3CBR%20%2F%3EOthers%20may%20have%20some%20other%20methods%20here%20based%20on%20their%20experience.%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324319%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324319%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris.%3C%2FP%3E%3CP%3EThe%20Contact%20Group%20in%20the%20Shared%20Mailbox%20was%20deleted%20and%20can%20not%20be%20recovered.%20Only%20certain%20users%20have%20been%20given%20access%20to%20this%20Shared%20Mailbox.%3C%2FP%3E%3CP%3ESo%20I%20am%20wanting%20to%20create%20the%20orginal%20mailbox.%20I%20have%20created%20the%20Contact%20Group%20I%20just%20need%20to%20populate%20it%20with%20the%20contacts%20from%20the%20csv%20file.%20If%20it%20wasn't%20for%20so%20many%20contacts%20I%20would%20do%20it%20manually.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20reaching%20out.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324293%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20contacts%20from%20a%20CSV%20file%20into%20a%20Contact%20Group%20in%20a%20Shared%20Mailbox.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324293%22%20slang%3D%22en-US%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F270523%22%20target%3D%22_blank%22%3E%40gablake%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20these%20contacts%20were%20meant%20to%20be%20shared%20within%20the%20organisation%2C%20would%20you%20not%20simply%20import%20them%20into%20Exchange%20Online%20as%20external%20contacts%20so%20they%20appear%20in%20the%20GAL%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fo365info.com%2Fbulk-import-contacts-to-exchange-online-office-365-using-powershell-part-1-of-2%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fo365info.com%2Fbulk-import-contacts-to-exchange-online-office-365-using-powershell-part-1-of-2%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAny%20reason%20specifically%20for%20the%20contacts%20going%20into%20a%20shared%20mailbox%3F%20What%20would%20you%20like%20to%20achieve%3F%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Highlighted
New 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
Highlighted
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
Highlighted

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.

Highlighted
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
Highlighted

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

Highlighted

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.

Highlighted

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

Highlighted

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.

Highlighted

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

Highlighted

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.