Forum Discussion

JFM_12's avatar
JFM_12
Iron Contributor
Oct 26, 2023
Solved

Bulk create and iimport contacts into Teams Contacts

Hello I would like to bulk import contacts into Teams Contacts. How could this be possible. Our organization wants to share certain contacts to co-workers. How can this be possible? Regards JFM...
  • LeonPavesic's avatar
    LeonPavesic
    Oct 26, 2023

    Hi JFM_12,

    thanks for the update and more details.

    We can change the approach and try this:

    1. 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.
    2. 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)

Resources