Skip to content

Instantly share code, notes, and snippets.

View mozziemozz's full-sized avatar
🏖️
Out of office

Martin Heusser mozziemozz

🏖️
Out of office
View GitHub Profile
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Define UserId (the user you want to set presence for)
$UserId = ""
$allAudioFiles = @()
$allAudioFiles += Get-CsOnlineAudioFile -ApplicationId TenantGlobal
$allAudioFiles += Get-CsOnlineAudioFile -ApplicationId HuntGroup
$allAudioFiles += Get-CsOnlineAudioFile -ApplicationId OrgAutoAttendant
$audioFile = $allAudioFiles | Out-GridView -Title "Choose an audio file..." -PassThru
$content = Export-CsOnlineAudioFile -Identity $audioFile.Id -ApplicationId $audioFile.ApplicationId
$defaultPath = Get-Location
# Author: Martin Heusser (@mozzeph)
Connect-MicrosoftTeams
$autoAttendantSelection = Get-CsAutoAttendant | Select-Object Name, Identity| Out-GridView -Title "Choose an Auto Attendant from the list." -PassThru
$tr1 = New-CsOnlineTimeRange -Start 08:15 -End 12:00
$tr2 = New-CsOnlineTimeRange -Start 13:30 -End 17:45
#$tr3 = New-CsOnlineTimeRange -Start 08:30 -End 16:00
# Author: Martin Heusser (@mozzeph)
Connect-MicrosoftTeams
$allResourceAccounts = Get-CsOnlineApplicationInstance | Where-Object {$_.ApplicationId -eq "11cd3e2e-fccb-42ad-ad00-878b93575e07" -or $_.ApplicationId -eq "ce933385-9390-45d1-9512-c8d228074e07"}
$allDeepLinks = @()
foreach ($resourceAccount in $allResourceAccounts) {
# Author: Martin Heusser (@mozzeph)
# Required Scopes: "profile", "openid", "User.Read.All", "Chat.Create"
$AppId = ''
$AppSecret = ''
$TenantName = ''
function Connect-HTTPGraph {
param (
[Parameter(Mandatory=$true)][String]$AppId,
Connect-MicrosoftTeams
$allCallQueues = Get-CsCallQueue -WarningAction SilentlyContinue
$choices = @()
$callQueueCounter = 1
foreach ($callQueue in $allCallQueues) {
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$uri = "Your Runbook Webhook URL"
$refreshUri = "Your Refresh Card Function URL"
$actionCardCq = @'
{
param
(
[Parameter (Mandatory = $false)]
[object] $WebhookData
)
$uri = "Your Teams Channel Webhook URL"
$Body = (ConvertFrom-Json -InputObject $WebhookData.RequestBody)
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$action = $Request.Body.actionType
$callQueueName = $Request.Body.QueueName
$callQueueId = $Request.Body.QueueId
$targetNumber = $Request.Body.Number
$defaultOverFlowThreshold = 10
$webHookUrl = ""
$Credentials = Get-AutomationPSCredential -Name "AzAutomationAdmin"
Connect-MicrosoftTeams -Credential $Credentials
$allCallQueues = Get-CsCallQueue -WarningAction SilentlyContinue
foreach ($callQueue in $allCallQueues) {