Skip to content

Install Teams for Linux

Download the latest Linux Debian package

Download the package using the link on this page.

Install the package

Install it using dpkg.

dpkg -i teams_xx.xx.xx.xxxx_amd64.deb

The installer also adds a source list file in source.list.d to keep the application up-to-date.

deb [arch=amd64] https://packages.microsoft.com/repos/ms-teams stable main

MS-Teams invites do not use the protocol msteams:// but https://. This means that xdg-open or open is called no longer. The next script msteams-link.sh transforms a given https URL into a msteams URL.

When the current clipboard content matches a Teams invite the clipboard ios used as input and when not the URL is asked for in a dialog.

#!/bin/bash

##
## Script for transforming MS-Teams 'https://' link into 'msteams://'
## Using the clipboard as input.
# Example: https://teams.microsoft.com/meetingOptions/?organizerId=46f6e343-7980-42bc-82b7-c589f1e46e5b&tenantId=35544712-2af9-4a99-be71-9da4a6eb9ab0

# Prints the help to stderr.
#
function ShowHelp()
{
    echo "Usage: $(basename "${0}") [<options>]
  Script to transform an MS-Teams URL 'https://' to a' msteams://' one
  in order to join using the application instead of the browser.
  -i,--install: Install a desktop file on the desktop to execute the script.
  -h,--help: Show this help.
  No options will check the clipboard or opens a dialog for a link to open on MS-Teams.
    "
}

# Check if the needed commands are installed.
COMMANDS=("xclip" "kdialog")
for COMMAND in "${COMMANDS[@]}"; do
    if ! command -v "${COMMAND}" >/dev/null; then
        echo "Missing command '${COMMAND}' for this script"
        exit 1
    fi
done

# Create file on desktop.
#
function CreateDesktopFile() {
    local file
    file="$(xdg-user-dir DESKTOP)/MS-Teams Link.desktop"
    cat <<__EOF__ > "${file}"
[Desktop Entry]
Comment[en_US]=
Comment=
Type=Application
Exec="${BASH_SOURCE[0]}"
GenericName[en_US]=
GenericName=
Icon=/usr/share/pixmaps/teams.png
MimeType=
Name[en_US]=MS-Teams Link
Name=MS-Teams Link
__EOF__
    chmod +x "${file}"
}

# Open the link from the clipboard or read one from a popping up dialog.
#
function OpenTeamsLink()
{
    local https_link
    # Read the link from the clip board.
    https_link="$(xclip -o -selection clipboard)"
    # Check if the string starts with 'https:'
    if [[ ! "${https_link}" = "https://teams."* ]]; then
        #https_link="$(zenity --forms --title="Open Microsoft Teams Link" --text="URL" --add-entry="Paste Here >>")"
        https_link="$(kdialog --geometry="600x300+300+300" --inputbox "Paste Here" --title "Open Microsoft Teams Link" "${https_link}")"
    fi
    # Check if the string is empty.
    if [[ -n "${https_link}" ]] ; then
        echo "Success"
        xdg-open "${https_link/https:/msteams:}"
    fi
}

# Get options.
#
options=$(getopt -o ih -l help,install -- "${@}")
if [[ $? -ne 0 ]] ; then
    usage "$(basename "${0}")"
    exit 1
fi

eval set -- "${options}"
while true; do
    case "${1}" in

    -i | --install)
            CreateDesktopFile
            break
            ;;
    -h | --help)
            ShowHelp
            break
            ;;

    *)
        OpenTeamsLink
        break
        ;;
    esac
done