Table of Contents
Removing the Share to Teams Outlook Add-in
I’ve never had more than a passing relationship with Microsoft 365 integrated apps (Figure 1). The most I have done is deploy some Outlook add-ins to Exchange Online mailboxes like the Message Header Analyzer.
All of which meant that I probably wasn’t the best person to ask how to remove the Share to Teams Outlook add-in for selected mailboxes. The Share to Teams add-in allows an Outlook user to post a message from Outlook to a one-to-one or group chat or to create a new conversation in a team channel (Figure 2).
Essentially, the add-on signs into Teams for the user and posts the message using a Graph API request. The add-on only works for the user’s home tenant. You can’t use it to post as a guest member to a host tenant. I quite like the add-in but admit that I don’t use it very often. At this point, Share to Teams seems like something that Microsoft had to develop to help people move from email-centric work habits to the chat-based nature of Teams.
Whether Share to Teams helped very much is an open question, but its existence was probably enough to reassure people that it is possible to send information to and from between Outlook and Teams, which has an equivalent Share to Outlook feature to transmit messages in the opposite direction.
Exchange Online App Management Cmdlets
Some research revealed that PowerShell offers a viable solution. The Exchange Online management module contains cmdlets to create, list, remove, and disable apps. For instance, the Get-App cmdlet reveals details of the installed apps for a mailbox:
Get-App -Mailbox lotte.vetler | Format-Table AppId, DisplayName, ProviderName AppId DisplayName ProviderName ----- ----------- ------------ 131a8b55-bd40-4fec-b2e6-d68bf5929976 Translator Microsoft afde34e6-58a4-4122-8a52-ef402180a878 Polls Microsoft Corporation 545d8236-721a-468f-85d8-254eca7cb0da Share to Teams Microsoft 6b47614e-0125-454b-9f76-bd5aef85ac7b Send to OneNote Microsoft Corporation fe93bfe1-7947-460a-a5e0-7a5906b51360 Viva Insights Microsoft 62916641-fc48-44ae-a2a3-163811f1c945 Message Header Analyzer Stephen Griffin 6046742c-3aee-485e-a4ac-92ab7199db2e Report Message Microsoft Corporation c61bb978-adb2-4344-abe9-d599aa75704f EmailTranslator V1.1 Avishkaram f60b8ac7-c3e3-4e42-8dad-e4e1fea59ff7 Action Items Microsoft 7a774f0c-7a6f-11e0-85ad-07fb4824019b Bing Maps Microsoft a216ceed-7791-4635-a752-5a4ac0a5eb93 My Templates Microsoft bc13b9d0-5ba2-446a-956b-c583bdc94d5e Suggested Meetings Microsoft d39dee0e-fdc3-4015-af8d-94d4d49294b3 Unsubscribe Microsoft
The AppId identifier is important because it’s the required value to pass to tell the cmdlet which app to manage.
Scripting Disabling an App
The first task is to identify the set of mailboxes to process. I don’t know why the desire existed to remove the Share to Teams add-in. Perhaps it’s because a division within the company has decided that their users should not use the add-in. Maybe some senior manager took a dislike to the add-in. Or maybe it’s the result of a decision to separate Outlook and Teams communications. For whatever reason, it’s still important to find mailboxes to process. You can do this with the Get-ExoMailbox cmdlet.
Once the targets are identified, it’s a matter of looping through the mailboxes to use the Disable-App cmdlet to turn off the add-in for each mailbox. This code fetches a set of mailboxes based on a value in a custom attribute and checks each to extract the set of enabled apps. If that set includes the Share to Teams app, the Disable-App cmdlet turns Share to Teams off.
$TargetAppId = "545d8236-721a-468f-85d8-254eca7cb0da" # Id for the Share to Teams app $TargetAppName = "Share to Teams" [int]$RemovedApps = 0 [array]$Mbx = Get-ExoMailbox -Filter {CustomAttribute9 -eq 'NoApp'} -RecipientTypeDetails UserMailbox ForEach ($M in $Mbx) { Write-Host ("Checking mailbox {0} for the {1} app" -f $M.displayName, $TargetAppName) [array]$InstalledApps = Get-App -Mailbox $M.Alias | ` Where-Object {$_.Enabled -eq $true} | Select-Object -ExpandProperty AppId If ($InstalledApps -contains $TargetAppId) { Write-Host ("Disabling app for {0}" -f $M.displayName) -ForegroundColor Yellow Disable-App -Identity $TargetAppId -Mailbox $M.Alias -Confirm:$False $RemovedApps++ } Else { Write-Host ("App {0} not installed for {1}" -f $TargetAppName, $M.displayName) } } Write-Host ("Removed {0} instances of the {1} app from {2} scanned mailboxes" -f $RemovedApps, $TargetAppName, $Mbx.count)
Disabling Outlook Add-ins Isn’t Immediate
It usually takes several hours before Outlook picks up the newly disabled status for the add-in. The app data is cached within the service and refreshed periodically. That refresh must happen before clients can detect the change. There’s nothing you can do to accelerate the process, so consume some of your favorite beverage and chill out.
Learn more about how the Office 365 applications really work on an ongoing basis by subscribing to the Office 365 for IT Pros eBook. Our monthly updates keep subscribers informed about what’s important across the Office 365 ecosystem.
Thank you for the great post, will this work in removing viva insights add-in as well?
Yep. Just use AppId fe93bfe1-7947-460a-a5e0-7a5906b51360