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
# 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 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 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 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 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 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", | |
"owners@odata.bind": [ | |
"https://graph.microsoft.com/v1.0/users/{id}" # Use object ID or UPN of user | |
], | |
"groupTypes": [ |
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
$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 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 | |
) |
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 Remove-MyItem { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory, Position = 1)] | |
[string] | |
$Path | |
) | |
$item = Get-Item -Path $Path |
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 Remove-MyItem { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory, Position = 1)] | |
[string] | |
$Path | |
) | |
$item = Get-Item -Path $Path |