Forum Discussion

JFM_12's avatar
JFM_12
Iron Contributor
Oct 26, 2023

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_12

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi JFM_12,

    bulk importing contacts into Microsoft Teams is not a built-in feature, but you can try to use this approach.

    1. Create (prepare) Your Contacts:
    - Create a well-formatted CSV file containing the contact information you want to import, including names and email addresses.

    2. Import Contacts into Microsoft 365 (Exchange Online):
    - Use PowerShell to import contacts into Exchange Online, which is part of Microsoft 365. Here is a simplified script example:

    # Connect to Exchange Online
    Connect-ExchangeOnline -UserPrincipalName email address removed for privacy reasons -ShowProgress $true
    
    # Import Contacts from CSV
    Import-Csv "C:\Path\to\your\contacts.csv" | ForEach-Object {
    New-MailContact -Name $_.Name -ExternalEmailAddress $_.Email
    }

     

    3. Synchronize Contacts with Teams:
    - Contacts added to Exchange Online should be visible to your users in Teams since Teams often relies on Exchange for contacts.

    4. Share Contacts:
    - In Teams, you can share contacts by adding them to a Team's chat or to your personal contacts list. This will make them accessible across Teams.


    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)

    • JFM_12's avatar
      JFM_12
      Iron Contributor
      Hello Leon
      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
      • LeonPavesic's avatar
        LeonPavesic
        Silver Contributor

        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