Created
November 28, 2018 16:44
-
-
Save brettmillerb/2e2ca4dcd2cf96061e16e256fd0ad097 to your computer and use it in GitHub Desktop.
MicrosoftTeams module wrapper functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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