This file contains hidden or 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
DynamicParam { | |
if ($ChannelType -eq 'Private') { | |
# Define parameter attributes | |
$paramAttributes = New-Object -Type System.Management.Automation.ParameterAttribute | |
$paramAttributes.Mandatory = $true | |
# Create collection of the attributes | |
$paramAttributesCollect = New-Object -Type ` | |
System.Collections.ObjectModel.Collection[System.Attribute] | |
$paramAttributesCollect.Add($paramAttributes) |
This file contains hidden or 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
$userPhoneNumbers = Get-CsPhoneNumberAssignment -CapabilitiesContain UserAssignment -Top ([int]::MaxValue) | |
foreach ($number in $userPhoneNumbers) { | |
if ($null -ne $number.AssignedPstnTargetId) { | |
$user = Get-CsOnlineUser -Identity $number.AssignedPstnTargetId | |
} | |
else { | |
$user = [PSCustomObject]@{ | |
DisplayName = "Not Assigned" | |
UserPrincipalName = $null |
This file contains hidden or 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
# Create credential object and get access token | |
$secureClientSecret = ConvertTo-SecureString -String $env:ClientSecret -AsPlainText -Force | |
$graphApiCreds = New-Object System.Management.Automation.PSCredential($env:ClientId, $secureClientSecret) | |
$accessToken = Get-GraphApiAccessToken -Credential $graphApiCreds -TenantId $env:TenantId | |
# Get previous 2 day of records | |
$pstnRecords = Get-TeamsPstnCalls -Days 2 -AccessToken $accessToken | |
$pstnRecordCount = $pstnRecords.Count | |
$counter = 1 | |
Write-Information -MessageData "Found $pstnRecordCount records" |
This file contains hidden or 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
Import-Module .\PSSomethingModule.psm1 -Force | |
Describe "Get-Something" { | |
Context "when parameter ThingToGet is not used" { | |
It "should return 'I got something!'" { | |
Get-Something | Should -Be 'I got something!' | |
} | |
It "should be a string" { | |
Get-Something | Should -BeOfType System.String |
This file contains hidden or 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
# Configure app registration and tenant information | |
$env:graphApiDemoAppId = "12345678-abcd-efgh-jklm-123456789abc" # Replace with your Azure AD app id | |
$env:graphApiDemoAppSecret = "1234567890asdfjk;l54321" # Replace with your Azure AD app secret | |
$env:tenantId = "12345678-abcd-efgh-ijkl-987654321wxyz" # Replace with your Azure AD tenant ID | |
$oauthUri = "https://login.microsoftonline.com/$env:tenantId/oauth2/v2.0/token" | |
# Create token request body | |
$tokenBody = @{ | |
client_id = $env:graphApiDemoAppId |
This file contains hidden or 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
$channelBody = | |
'{ | |
"displayName": "Channel from Graph API", | |
"description": "Demo how to make a channel using graph api" | |
}' | |
$newChannel = Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/teams/$($newTeam.id)/channels" -Method POST -Headers $headers -Body $channelBody |
This file contains hidden or 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
# Create the team request body | |
$teamBody = | |
'{ | |
"memberSettings": { | |
"allowCreateUpdateChannels": true, | |
"allowDeleteChannels": true, | |
"allowAddRemoveApps": true, | |
"allowCreateUpdateRemoveTabs": true, | |
"allowCreateUpdateRemoveConnectors": true | |
}, |
This file contains hidden or 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
# Create group request body | |
$groupBody = | |
'{ | |
"displayName": "Team from Graph API Demo", | |
"mailNickname": "teamfromgraphapidemo", | |
"description": "Demo making a group from Graph API", | |
"[email protected]": [ | |
"https://graph.microsoft.com/v1.0/users/{id}" # Use object ID or UPN of user | |
], | |
"groupTypes": [ |
This file contains hidden or 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
$env:graphApiDemoAppId = "12345678-abcd-efgh-jklm-123456789abc" # Replace with your Azure AD app id | |
$env:graphApiDemoAppSecret = "1234567890asdfjk;l54321" # Replace with your Azure AD app secret | |
$env:tenantId = "12345678-abcd-efgh-ijkl-987654321wxyz" # Replace with your Azure AD tenant ID | |
$oauthUri = "https://login.microsoftonline.com/$env:tenantId/oauth2/v2.0/token" | |
# Create token request body | |
$tokenBody = @{ | |
client_id = $env:graphApiDemoAppId | |
client_secret = $env:graphApiDemoAppSecret |
This file contains hidden or 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
Add-Type -AssemblyName System.Windows.Forms | |
Add-Type -AssemblyName System.Drawing | |
function Remove-MyItem { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory, Position = 1)] | |
[string] | |
$Path | |
) |