Skip to content

Instantly share code, notes, and snippets.

@brettmillerb
Created November 28, 2018 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettmillerb/2e2ca4dcd2cf96061e16e256fd0ad097 to your computer and use it in GitHub Desktop.
Save brettmillerb/2e2ca4dcd2cf96061e16e256fd0ad097 to your computer and use it in GitHub Desktop.
MicrosoftTeams module wrapper functions
function New-MsTeamsChannel {
[cmdletbinding(DefaultParameterSetName = 'Input')]
param (
[Parameter(Mandatory,
Position = 0,
ValueFromPipeline,
ValueFromPipelineByPropertyName,
ParameterSetName = 'Input')]
[string[]]
$DisplayName,
[Parameter(Mandatory)]
[string]
$TeamName
)
begin {
$teamGroupId = Get-Team | Where-Object displayname -like "*$TeamName*" | Select -ExpandProperty GroupId
}
process {
if ($PSCmdlet.ParameterSetName -eq 'Input') {
foreach ($item in $DisplayName) {
[PSCustomObject]@{
DisplayName = $item
GroupId = $teamGroupId
}
}
}
else {
[PSCustomObject]@{
Displayname = $_.DisplayName
GroupId = $_.TeamName
}
}
}
}
function Get-MsTeamsGroupId {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[ValidateNotNullOrEmpty()]
[string]
$TeamName
)
process {
Get-Team | Where-Object displayname -like "*$TeamName*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment