Forum Discussion
Bulk create and iimport contacts into Teams Contacts
- Oct 26, 2023
Hi JFM_12,
thanks for the update and more details.
We can change the approach and try this:Prepare Your Contacts in Azure Active Directory (AAD):
- Ensure that all the contacts you want to import into Teams are already present in your Azure Active Directory.
- Make sure that the contacts have names and email addresses, and that their names follow the naming convention you want to use in Teams.
Export Contacts from Azure Active Directory:
You can use PowerShell to export contacts from Azure Active Directory. Here's a sample script:
# Connect to Azure AD Connect-AzureAD -TenantId <YourTenantId> # Export contacts to a CSV file Get-AzureADContact | Select-Object DisplayName,PrimarySmtpAddress | Export-Csv -Path "C:\Path\to\contacts.csv" -NoTypeInformationThis script will export the display names and primary SMTP addresses of your contacts to a CSV file.
Import Contacts into Microsoft 365 (Exchange Online):
Use PowerShell to import the contacts into Exchange Online, which is part of Microsoft 365. Here's a simplified script example:
# Connect to Exchange Online Connect-ExchangeOnline -UserPrincipalName <YourAdminUser> -ShowProgress $true # Import Contacts from CSV Import-Csv "C:\Path\to\contacts.csv" | ForEach-Object { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.PrimarySmtpAddress }Replace <YourAdminUser> with the admin user's email address.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
Thank you for your answer.
We have them in AAD but would like to generate teams contacts.
With the same naming. The goal is to make them find for all users in the same way and with the same expression.
Regards
JFM_12
Hi JFM_12,
thanks for the update and more details.
We can change the approach and try this:
Prepare Your Contacts in Azure Active Directory (AAD):
- Ensure that all the contacts you want to import into Teams are already present in your Azure Active Directory.
- Make sure that the contacts have names and email addresses, and that their names follow the naming convention you want to use in Teams.
Export Contacts from Azure Active Directory:
You can use PowerShell to export contacts from Azure Active Directory. Here's a sample script:
# Connect to Azure AD Connect-AzureAD -TenantId <YourTenantId>
# Export contacts to a CSV file
Get-AzureADContact | Select-Object DisplayName,PrimarySmtpAddress | Export-Csv -Path "C:\Path\to\contacts.csv" -NoTypeInformation
This script will export the display names and primary SMTP addresses of your contacts to a CSV file.
Import Contacts into Microsoft 365 (Exchange Online):
Use PowerShell to import the contacts into Exchange Online, which is part of Microsoft 365. Here's a simplified script example:
# Connect to Exchange Online
Connect-ExchangeOnline -UserPrincipalName <YourAdminUser> -ShowProgress $true
# Import Contacts from CSV
Import-Csv "C:\Path\to\contacts.csv" | ForEach-Object {
New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.PrimarySmtpAddress
}
Replace <YourAdminUser> with the admin user's email address.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- jens_admin_noobJan 10, 2025Copper Contributor
Hi,
we have multiple locations, and I would like to know, if there is a way to import contatcs just for one location.
Or maybe there is a workaround to provide these contacts only for the users at that particular location?There is no need to provide the contacts to the whole company.
Kind regards
Jens