From 10644efd1c57446ff25f06bf05ae7ecb0d81d39f Mon Sep 17 00:00:00 2001 From: Timothy Wamalwa Date: Sat, 27 May 2023 14:25:11 +0300 Subject: [PATCH 1/3] Reviewed script by adding commands with corresponding path and method to the hash table --- tools/ExamplesGenerator.ps1 | 171 ++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 94 deletions(-) diff --git a/tools/ExamplesGenerator.ps1 b/tools/ExamplesGenerator.ps1 index ceafae2f28c..03dcb323120 100644 --- a/tools/ExamplesGenerator.ps1 +++ b/tools/ExamplesGenerator.ps1 @@ -24,7 +24,7 @@ function Start-Generator { ) $GraphMapping = @{ - "v1.0" = "examples\v1.0" + #"v1.0" = "examples\v1.0" "beta" = "examples\v1.0-beta" } if ($GenerationMode -eq "auto") { @@ -87,16 +87,19 @@ function Get-Files { #Extract command over here $Command = [System.IO.Path]::GetFileNameWithoutExtension($File) #Extract URI path - $UriPath = $null + $CommandValue = $null if($GraphProfile -eq "beta"){ - $UriPath = $BetaCommandGetVariantList[$Command] + $CommandValue = $BetaCommandGetVariantList[$Command] + }else{ - $UriPath = $V1CommandGetVariantList[$Command] + $CommandValue = $V1CommandGetVariantList[$Command] } - if ($UriPath) { - $Method = $UriPaths.Method - Get-ExternalDocsUrl -GraphProfile $GraphProfile -Url -UriPath $UriPath -Command $Command -OpenApiContent $OpenApiContent -GraphProfilePath $GraphProfilePath -Method $Method -Module $Module + if ($CommandValue) { + $CommandValueParams = $CommandValue.Split(",") + $ApiPath = $CommandValueParams[0] + $Method = $CommandValueParams[1] + Get-ExternalDocsUrl -GraphProfile $GraphProfile -Url -UriPath $ApiPath -Command $Command -OpenApiContent $OpenApiContent -GraphProfilePath $GraphProfilePath -Method $Method.Trim() -Module $Module } } @@ -139,94 +142,54 @@ function Get-ExternalDocsUrl { if ($OpenApiContent.openapi && $OpenApiContent.info.version) { foreach ($Path in $OpenApiContent.paths) { - $MethodName = $Method | Out-String - $ExternalDocUrl = $Path[$UriPath].values.externalDocs.url - - if ([string]::IsNullOrEmpty($ExternalDocUrl)) { - $PathSplit = $UriPath.Split("/") - $PathToAppend = $PathSplit[$PathSplit.Count - 1] - if ($PathToAppend.StartsWith("{") -or $PathToAppend.StartsWith("$")) { - #skip - } - else { - $PathRebuild = "/" + $PathSplit[0] - for ($i = 1; $i -lt $PathSplit.Count - 1; $i++) { - $PathRebuild += $PathSplit[$i] + "/" + $ExternalDocUrl = $null + switch($Method){ + "GET" { + $ExternalDocUrl = $path[$UriPath].get.externalDocs.url + if ([string]::IsNullOrEmpty($ExternalDocUrl)) { + $GETApiPath = Extract-PathFromListVariant -GraphProfile $GraphProfile -Command $Command + if(-not([string]::IsNullOrEmpty($GETApiPath))){ + $ExternalDocUrl = $Path[$GETApiPath].get.externalDocs.url + } } - $RebuiltPath = $PathRebuild + "microsoft.graph." + $PathToAppend - $ExternalDocUrl = $path[$RebuiltPath].get.externalDocs.url + } + "POST" { + $ExternalDocUrl = $Path[$UriPath].post.externalDocs.url if ([string]::IsNullOrEmpty($ExternalDocUrl)) { - $GetPath = $null - if($GraphProfile -eq "beta"){ - $GetPath = $BetaCommandListVariantList[$Command] - }else{ - $GetPath = $V1CommandListVariantList[$Command] - } - if(-not([string]::IsNullOrEmpty($GetPath))){ - $ExternalDocUrl = $Path[$GetPath].get.externalDocs.url - } - + $POSTApiPath = Extract-PathFromListVariant -GraphProfile $GraphProfile -Command $Command + if(-not([string]::IsNullOrEmpty($POSTApiPath))){ + $ExternalDocUrl = $Path[$POSTApiPath].post.externalDocs.url + } + } + } + "PATCH" { + $ExternalDocUrl = $Path[$UriPath].patch.externalDocs.url + if ([string]::IsNullOrEmpty($ExternalDocUrl)) { + $PATCHApiPath = Extract-PathFromListVariant -GraphProfile $GraphProfile -Command $Command + if(-not([string]::IsNullOrEmpty($PATCHApiPath))){ + $ExternalDocUrl = $Path[$PATCHApiPath].patch.externalDocs.url + } } } - } - if ($MethodName -eq "POST") { - $ExternalDocUrl = $Path[$UriPath].post.externalDocs.url - if ([string]::IsNullOrEmpty($ExternalDocUrl)) { - $PostPath = $null - if($GraphProfile -eq "beta"){ - $PostPath = $BetaCommandListVariantList[$Command] - }else{ - $PostPath = $V1CommandListVariantList[$Command] + "DELETE" { + $ExternalDocUrl = $Path[$UriPath].delete.externalDocs.url + if ([string]::IsNullOrEmpty($ExternalDocUrl)) { + $DELETEApiPath = Extract-PathFromListVariant -GraphProfile $GraphProfile -Command $Command + if(-not([string]::IsNullOrEmpty($DELETEApiPath))){ + $ExternalDocUrl = $Path[$DELETEApiPath].delete.externalDocs.url + } } - if(-not([string]::IsNullOrEmpty($PostPath))){ - $ExternalDocUrl = $Path[$PostPath].post.externalDocs.url - } - } - } - - if ($MethodName -eq "PATCH") { - $ExternalDocUrl = $Path[$UriPath].patch.externalDocs.url - if ([string]::IsNullOrEmpty($ExternalDocUrl)) { - $PatchPath = $null - if($GraphProfile -eq "beta"){ - $PatchPath = $BetaCommandListVariantList[$Command] - }else{ - $PatchPath = $V1CommandListVariantList[$Command] - } - if(-not([string]::IsNullOrEmpty($PatchPath))){ - $ExternalDocUrl = $Path[$PatchPath].post.externalDocs.url - } - } - } - - if ($MethodName -eq "DELETE") { - $ExternalDocUrl = $Path[$UriPath].delete.externalDocs.url - if ([string]::IsNullOrEmpty($ExternalDocUrl)) { - $DeletePath = $null - if($GraphProfile -eq "beta"){ - $DeletePath = $BetaCommandListVariantList[$Command] - }else{ - $DeletePath = $V1CommandListVariantList[$Command] - } - if(-not([string]::IsNullOrEmpty($DeletePath))){ - $ExternalDocUrl = $Path[$DeletePath].post.externalDocs.url - } - } - } - - if ($MethodName -eq "PUT") { - $ExternalDocUrl = $Path[$UriPath].put.externalDocs.url - if ([string]::IsNullOrEmpty($ExternalDocUrl)) { - $PutPath = $null - if($GraphProfile -eq "beta"){ - $PutPath = $BetaCommandListVariantList[$Command] - }else{ - $PutPath = $V1CommandListVariantList[$Command] + } + "PUT" { + $ExternalDocUrl = $Path[$UriPath].put.externalDocs.url + if ([string]::IsNullOrEmpty($ExternalDocUrl)) { + $PUTApiPath = Extract-PathFromListVariant -GraphProfile $GraphProfile -Command $Command + if(-not([string]::IsNullOrEmpty($PUTApiPath))){ + $ExternalDocUrl = $Path[$PUTApiPath].put.externalDocs.url + } } - if(-not([string]::IsNullOrEmpty($PutPath))){ - $ExternalDocUrl = $Path[$PutPath].post.externalDocs.url - } - } + } + } if (-not([string]::IsNullOrEmpty($ExternalDocUrl))) { Start-WebScrapping -GraphProfile $GraphProfile -ExternalDocUrl $ExternalDocUrl -Command $Command -GraphProfilePath $GraphProfilePath -UriPath $UriPath -Module $Module @@ -238,6 +201,25 @@ function Get-ExternalDocsUrl { } } +function Extract-PathFromListVariant{ + param( + [ValidateSet("beta", "v1.0")] + [string] $GraphProfile = "v1.0", + [string] $Command = "Get-MgUser" + ) + $ListApiPath = $null + $ListCommandValue = $null + if($GraphProfile -eq "beta"){ + $ListCommandValue = $BetaCommandListVariantList[$Command] + }else{ + $ListCommandValue = $V1CommandListVariantList[$Command] + } + if(-not([string]::IsNullOrEmpty($ListCommandValue))){ + $ListCommandValueParams = $ListCommandValue.Split(",") + $ListApiPath = $ListCommandValueParams[0] + } + return $ListApiPath +} function Start-WebScrapping { param( [ValidateSet("beta", "v1.0")] @@ -397,19 +379,20 @@ foreach($Data in $DeserializedContent) if($Data.ApiVersion -eq "beta") { if((-not($Data.Variants[0].Contains("List")))){ - $Beta = $BetaCommandGetVariantList.Add($Data.Command, $Data.Uri) + $BetaAPIPathAndMethod = $Data.Uri,$Data.Method -join "," + $Beta = $BetaCommandGetVariantList.Add($Data.Command, $BetaAPIPathAndMethod) }else{ - $Beta1 = $BetaCommandListVariantList.Add($Data.Command, $Data.Uri) + $Beta1 = $BetaCommandListVariantList.Add($Data.Command, $BetaAPIPathAndMethod) } } if($Data.ApiVersion -eq "v1.0") { - + $V1APIPathAndMethod = $Data.Uri,$Data.Method -join "," if((-not($Data.Variants[0].Contains("List")))){ - $V1 = $V1CommandGetVariantList.Add($Data.Command, $Data.Uri) + $V1 = $V1CommandGetVariantList.Add($Data.Command, $V1APIPathAndMethod) }else{ - $V11 = $V1CommandListVariantList.Add($Data.Command, $Data.Uri) + $V11 = $V1CommandListVariantList.Add($Data.Command, $V1APIPathAndMethod) } } } From 65cf0805f73f336905987f4e0c4d592d6dc8d65f Mon Sep 17 00:00:00 2001 From: Timothy Wamalwa Date: Mon, 29 May 2023 15:16:46 +0300 Subject: [PATCH 2/3] Reviewed script --- tools/ExamplesGenerator.ps1 | 42 +++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/tools/ExamplesGenerator.ps1 b/tools/ExamplesGenerator.ps1 index 03dcb323120..5eda1978698 100644 --- a/tools/ExamplesGenerator.ps1 +++ b/tools/ExamplesGenerator.ps1 @@ -304,6 +304,8 @@ function Update-ExampleFile { $HeadCount = $HeaderList.Count $ExampleCount = $ExampleList.Count $WrongExamplesCount = 0; + $SkippedExample = -1 + $ContainsRightExamples = $False #===========================Importing new examples into files ============================================# if ($ReplaceEverything -and $ExampleCount -gt 0 -and $HeadCount -eq $ExampleCount) { Clear-Content $ExampleFile -Force @@ -315,12 +317,16 @@ function Update-ExampleFile { $TotalText = "$TitleValue`r`n`n$Code`r`n$Description`r`n" Add-Content -Path $ExampleFile -Value $TotalText + $ContainsRightExamples = $True }else{ $WrongExamplesCount++ + $SkippedExample++ } } } + #The code below updates existing examples + #------------------------------------------------------------# $PatternToSearch = "Import-Module Microsoft.Graph.$Module" if(($Content | Select-String -pattern $SearchText) -and ($Content | Select-String -pattern "This example shows")){ $ContainsPatternToSearch = $False @@ -331,14 +337,17 @@ function Update-ExampleFile { } if($ContainsPatternToSearch){ Clear-Content $ExampleFile -Force - #Replace everything for ($d = 0; $d -lt $HeaderList.Count; $d++) { + if($ExampleList[$d].Contains($Command)){ $CodeValue = $ExampleList[$d].Trim() $TitleValue = "### " + $HeaderList[$d].Trim() $Code = "``````powershell`r$CodeValue`r`n``````" $TotalText = "$TitleValue`r`n`n$Code`r`n$Description`r`n" Add-Content -Path $ExampleFile -Value $TotalText + }else{ + $SkippedExample++ + } } }else{ @@ -349,7 +358,36 @@ function Update-ExampleFile { } } - if($WrongExamplesCount -gt 0){ + #The code below corrects the numbering of the example headers/title if there is a situation where + #some examples are wrong(which are left out) and some are right + #-----------------------------------------------------------------------------------------------# + $AvailableCorrectExamples = 1 + if($SkippedExample -gt -1){ + $NewContent = Get-Content -Path $ExampleFile + foreach($C in $NewContent){ + if($C.Contains("Example")){ + $SearchString = $c.Split(":") + $StringToReplace = $SearchString[0] + $ReplacementString = "### Example $AvailableCorrectExamples" + (Get-Content -Path $ExampleFile) -replace $StringToReplace, $ReplacementString | Set-Content $ExampleFile + $AvailableCorrectExamples++ + } + } + if(-not(Test-Path -PathType Container $FolderForExamplesToBeReviewed)){ + New-Item -ItemType Directory -Force -Path $FolderForExamplesToBeReviewed + } + if (-not (Test-Path "$FolderForExamplesToBeReviewed\$ExamplesToBeReviewed")) { + "Command, ExternalDocsUrl, ApiVersion" | Out-File -FilePath "$FolderForExamplesToBeReviewed\$ExamplesToBeReviewed" -Encoding ASCII + } + + $File = Get-Content "$FolderForExamplesToBeReviewed\$ExamplesToBeReviewed" + $containsWord = $File | % { $_ -match "$Command, $ExternalDocUrl, $GraphProfile, $UriPath" } + if (-not($containsWord -contains $true)) { + "$Command, $ExternalDocUrl, $GraphProfile, $UriPath" | Out-File -FilePath "$FolderForExamplesToBeReviewed\$ExamplesToBeReviewed" -Append -Encoding ASCII + } + } + #-----------------------------------------------------------------------------------------------------------------------------------------------------------------# + if(($WrongExamplesCount -gt 0) -and -not($ContainsRightExamples)){ $DefaultBoilerPlate = "### Example 1: {{ Add title here }}`r`n``````powershell`r`n PS C:\> {{ Add code here }}`r`n`n{{ Add output here }}`r`n```````n`n{{ Add description here }}`r`n`n### Example 2: {{ Add title here }}`r`n``````powershell`r`n PS C:\> {{ Add code here }}`r`n`n{{ Add output here }}`r`n```````n`n{{ Add description here }}`r`n`n" Add-Content -Path $ExampleFile -Value $DefaultBoilerPlate.Trim() #Log api path api version and equivalent external doc url giving wron examples From 2a7c3696050eae2a18ac9a49b5a2ce330018b793 Mon Sep 17 00:00:00 2001 From: Microsoft Graph DevX Tooling Date: Mon, 29 May 2023 14:22:14 +0000 Subject: [PATCH 3/3] Updating v1 examples --- .../v1.0-beta/Get-MgApplicationTemplate.md | 23 +- .../v1.0-beta/Remove-MgServicePrincipal.md | 16 +- .../examples/v1.0-beta/Update-MgPlace.md | 68 +-- .../examples/v1.0-beta/Get-MgSubscription.md | 23 +- .../examples/v1.0-beta/New-MgSubscription.md | 29 +- .../v1.0-beta/Remove-MgSubscription.md | 16 +- .../v1.0-beta/Update-MgSubscription.md | 19 +- .../v1.0-beta/Get-MgDirectoryObject.md | 16 +- .../v1.0-beta/Remove-MgDirectoryObject.md | 16 +- ...t-MgShareSharedDriveItemSharedDriveItem.md | 6 +- .../v1.0-beta/Get-MgGroupLifecyclePolicy.md | 23 +- .../v1.0-beta/New-MgGroupLifecyclePolicy.md | 23 +- .../Remove-MgGroupLifecyclePolicy.md | 16 +- .../Update-MgGroupLifecyclePolicy.md | 23 +- .../examples/v1.0-beta/Get-MgContract.md | 23 +- .../examples/v1.0-beta/Get-MgDevice.md | 60 +-- .../v1.0-beta/Get-MgDirectoryRoleTemplate.md | 23 +- .../examples/v1.0-beta/Get-MgOrganization.md | 23 +- .../examples/v1.0-beta/New-MgDevice.md | 34 +- .../examples/v1.0-beta/New-MgDirectoryRole.md | 19 +- .../examples/v1.0-beta/New-MgDomain.md | 23 +- .../examples/v1.0-beta/Remove-MgDevice.md | 16 +- .../examples/v1.0-beta/Remove-MgDomain.md | 16 +- .../examples/v1.0-beta/Update-MgDevice.md | 39 +- .../examples/v1.0-beta/Update-MgDomain.md | 21 +- .../v1.0-beta/Update-MgOrganization.md | 31 +- .../v1.0-beta/Get-MgDataPolicyOperation.md | 16 +- .../v1.0-beta/Get-MgOauth2PermissionGrant.md | 23 +- .../examples/v1.0-beta/New-MgInvitation.md | 4 +- .../v1.0-beta/New-MgOauth2PermissionGrant.md | 27 +- .../Remove-MgOauth2PermissionGrant.md | 16 +- .../Update-MgOauth2PermissionGrant.md | 19 +- .../v1.0-beta/Get-MgSchemaExtension.md | 23 +- .../v1.0-beta/New-MgSchemaExtension.md | 113 ++--- .../v1.0-beta/Remove-MgSchemaExtension.md | 16 +- .../v1.0-beta/Update-MgSchemaExtension.md | 65 +-- .../Sites/examples/v1.0-beta/Get-MgSite.md | 51 +-- .../Teams/examples/v1.0-beta/Get-MgChat.md | 37 +- .../Teams/examples/v1.0-beta/Get-MgTeam.md | 44 +- .../Teams/examples/v1.0-beta/New-MgChat.md | 226 ++++------ .../Teams/examples/v1.0-beta/New-MgTeam.md | 391 +++++++++--------- .../Teams/examples/v1.0-beta/Update-MgChat.md | 19 +- .../Teams/examples/v1.0-beta/Update-MgTeam.md | 37 +- 43 files changed, 819 insertions(+), 953 deletions(-) diff --git a/src/Applications/Applications/examples/v1.0-beta/Get-MgApplicationTemplate.md b/src/Applications/Applications/examples/v1.0-beta/Get-MgApplicationTemplate.md index 3d6e1be9646..8013df6f4ad 100644 --- a/src/Applications/Applications/examples/v1.0-beta/Get-MgApplicationTemplate.md +++ b/src/Applications/Applications/examples/v1.0-beta/Get-MgApplicationTemplate.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgApplicationTemplate Cmdlet -```powershell -Import-Module Microsoft.Graph.Applications -Get-MgApplicationTemplate -ApplicationTemplateId $applicationTemplateId -``` -This example shows how to use the Get-MgApplicationTemplate Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgApplicationTemplate Cmdlet -```powershell -Import-Module Microsoft.Graph.Applications -Get-MgApplicationTemplate -``` -This example shows how to use the Get-MgApplicationTemplate Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Applications + +Get-MgApplicationTemplate -ApplicationTemplateId $applicationTemplateId +``` +This example shows how to use the Get-MgApplicationTemplate Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Applications/Applications/examples/v1.0-beta/Remove-MgServicePrincipal.md b/src/Applications/Applications/examples/v1.0-beta/Remove-MgServicePrincipal.md index c8cdcb99005..9db63ffa5fd 100644 --- a/src/Applications/Applications/examples/v1.0-beta/Remove-MgServicePrincipal.md +++ b/src/Applications/Applications/examples/v1.0-beta/Remove-MgServicePrincipal.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgServicePrincipal Cmdlet -```powershell -Import-Module Microsoft.Graph.Applications -Remove-MgServicePrincipal -ServicePrincipalId $servicePrincipalId -``` -This example shows how to use the Remove-MgServicePrincipal Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Applications + +Remove-MgServicePrincipal -ServicePrincipalId $servicePrincipalId +``` +This example shows how to use the Remove-MgServicePrincipal Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Calendar/Calendar/examples/v1.0-beta/Update-MgPlace.md b/src/Calendar/Calendar/examples/v1.0-beta/Update-MgPlace.md index 5915276ef61..b079cacb455 100644 --- a/src/Calendar/Calendar/examples/v1.0-beta/Update-MgPlace.md +++ b/src/Calendar/Calendar/examples/v1.0-beta/Update-MgPlace.md @@ -1,56 +1,18 @@ -### Example 1: Using the Update-MgPlace Cmdlet -```powershell -Import-Module Microsoft.Graph.Calendar +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Calendar + $params = @{ "@odata.type" = "microsoft.graph.room" - Nickname = "Conf Room" - Building = "1" - Label = "100" - Capacity = - IsWheelChairAccessible = $false + nickname = "Conf Room" + building = "1" + label = "100" + capacity = + isWheelChairAccessible = $false } -Update-MgPlace -PlaceId $placeId -BodyParameter $params -``` -This example shows how to use the Update-MgPlace Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Update-MgPlace Cmdlet -```powershell -Import-Module Microsoft.Graph.Calendar -$params = @{ - "@odata.type" = "microsoft.graph.roomList" - DisplayName = "Building 1" - Phone = "555-555-0100" - Address = @{ - Street = "4567 Main Street" - City = "Buffalo" - State = "NY" - PostalCode = "98052" - CountryOrRegion = "USA" - } - GeoCoordinates = @{ - Altitude = $null - Latitude = 47 - Longitude = -122 - Accuracy = $null - AltitudeAccuracy = $null - } -} -Update-MgPlace -PlaceId $placeId -BodyParameter $params -``` -This example shows how to use the Update-MgPlace Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the Update-MgPlace Cmdlet -```powershell -Import-Module Microsoft.Graph.Calendar -$params = @{ - "@odata.type" = "microsoft.graph.workspace" - Nickname = "Conf Room" - Building = "1" - Label = "100" - Capacity = - IsWheelChairAccessible = $false -} -Update-MgPlace -PlaceId $placeId -BodyParameter $params -``` -This example shows how to use the Update-MgPlace Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgPlace -PlaceId $placeId -BodyParameter $params +``` +This example shows how to use the Update-MgPlace Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Get-MgSubscription.md b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Get-MgSubscription.md index 1769d906f4e..1b736580f29 100644 --- a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Get-MgSubscription.md +++ b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Get-MgSubscription.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgSubscription Cmdlet -```powershell -Import-Module Microsoft.Graph.ChangeNotifications -Get-MgSubscription -SubscriptionId $subscriptionId -``` -This example shows how to use the Get-MgSubscription Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgSubscription Cmdlet -```powershell -Import-Module Microsoft.Graph.ChangeNotifications -Get-MgSubscription -``` -This example shows how to use the Get-MgSubscription Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.ChangeNotifications + +Get-MgSubscription -SubscriptionId $subscriptionId +``` +This example shows how to use the Get-MgSubscription Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/New-MgSubscription.md b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/New-MgSubscription.md index 04a885a039d..46333632f97 100644 --- a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/New-MgSubscription.md +++ b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/New-MgSubscription.md @@ -1,15 +1,18 @@ -### Example 1: Using the New-MgSubscription Cmdlet -```powershell -Import-Module Microsoft.Graph.ChangeNotifications +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.ChangeNotifications + $params = @{ - ChangeType = "created" - NotificationUrl = "https://webhook.azurewebsites.net/api/send/myNotifyClient" - Resource = "me/mailFolders('Inbox')/messages" - ExpirationDateTime = [System.DateTime]::Parse("2016-11-20T18:23:45.9356913Z") - ClientState = "secretClientValue" - LatestSupportedTlsVersion = "v1_2" + changeType = "created" + notificationUrl = "https://webhook.azurewebsites.net/api/send/myNotifyClient" + resource = "me/mailFolders('Inbox')/messages" + expirationDateTime = [System.DateTime]::Parse("2016-11-20T18:23:45.9356913Z") + clientState = "secretClientValue" + latestSupportedTlsVersion = "v1_2" } -New-MgSubscription -BodyParameter $params -``` -This example shows how to use the New-MgSubscription Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgSubscription -BodyParameter $params +``` +This example shows how to use the New-MgSubscription Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Remove-MgSubscription.md b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Remove-MgSubscription.md index b3e85fc18fc..9d7788f802b 100644 --- a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Remove-MgSubscription.md +++ b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Remove-MgSubscription.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgSubscription Cmdlet -```powershell -Import-Module Microsoft.Graph.ChangeNotifications -Remove-MgSubscription -SubscriptionId $subscriptionId -``` -This example shows how to use the Remove-MgSubscription Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.ChangeNotifications + +Remove-MgSubscription -SubscriptionId $subscriptionId +``` +This example shows how to use the Remove-MgSubscription Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Update-MgSubscription.md b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Update-MgSubscription.md index 63f13de21ad..bb9c0ae8805 100644 --- a/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Update-MgSubscription.md +++ b/src/ChangeNotifications/ChangeNotifications/examples/v1.0-beta/Update-MgSubscription.md @@ -1,10 +1,13 @@ -### Example 1: Using the Update-MgSubscription Cmdlet -```powershell -Import-Module Microsoft.Graph.ChangeNotifications +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.ChangeNotifications + $params = @{ - ExpirationDateTime = [System.DateTime]::Parse("2016-11-22T18:23:45.9356913Z") + expirationDateTime = [System.DateTime]::Parse("2016-11-22T18:23:45.9356913Z") } -Update-MgSubscription -SubscriptionId $subscriptionId -BodyParameter $params -``` -This example shows how to use the Update-MgSubscription Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgSubscription -SubscriptionId $subscriptionId -BodyParameter $params +``` +This example shows how to use the Update-MgSubscription Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Get-MgDirectoryObject.md b/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Get-MgDirectoryObject.md index c78fa264d7b..96d728fa9b1 100644 --- a/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Get-MgDirectoryObject.md +++ b/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Get-MgDirectoryObject.md @@ -1,7 +1,9 @@ -### Example 1: Using the Get-MgDirectoryObject Cmdlet -```powershell -Import-Module Microsoft.Graph.DirectoryObjects -Get-MgDirectoryObject -DirectoryObjectId $directoryObjectId -``` -This example shows how to use the Get-MgDirectoryObject Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.DirectoryObjects + +Get-MgDirectoryObject -DirectoryObjectId $directoryObjectId +``` +This example shows how to use the Get-MgDirectoryObject Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Remove-MgDirectoryObject.md b/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Remove-MgDirectoryObject.md index 225c5f869ba..260e0b41cd1 100644 --- a/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Remove-MgDirectoryObject.md +++ b/src/DirectoryObjects/DirectoryObjects/examples/v1.0-beta/Remove-MgDirectoryObject.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgDirectoryObject Cmdlet -```powershell -Import-Module Microsoft.Graph.DirectoryObjects -Remove-MgDirectoryObject -DirectoryObjectId $directoryObjectId -``` -This example shows how to use the Remove-MgDirectoryObject Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.DirectoryObjects + +Remove-MgDirectoryObject -DirectoryObjectId $directoryObjectId +``` +This example shows how to use the Remove-MgDirectoryObject Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Files/Files/examples/v1.0-beta/Get-MgShareSharedDriveItemSharedDriveItem.md b/src/Files/Files/examples/v1.0-beta/Get-MgShareSharedDriveItemSharedDriveItem.md index bf2eb45757a..41a0ce0796b 100644 --- a/src/Files/Files/examples/v1.0-beta/Get-MgShareSharedDriveItemSharedDriveItem.md +++ b/src/Files/Files/examples/v1.0-beta/Get-MgShareSharedDriveItemSharedDriveItem.md @@ -1,7 +1,11 @@ -### Example 1: Using the Get-MgShareSharedDriveItemSharedDriveItem Cmdlet +### Example 1: Code snippet + ```powershell Import-Module Microsoft.Graph.Files + Get-MgShareSharedDriveItemSharedDriveItem -SharedDriveItemId $sharedDriveItemId ``` This example shows how to use the Get-MgShareSharedDriveItemSharedDriveItem Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Groups/Groups/examples/v1.0-beta/Get-MgGroupLifecyclePolicy.md b/src/Groups/Groups/examples/v1.0-beta/Get-MgGroupLifecyclePolicy.md index 7f106a34079..d260f2c487a 100644 --- a/src/Groups/Groups/examples/v1.0-beta/Get-MgGroupLifecyclePolicy.md +++ b/src/Groups/Groups/examples/v1.0-beta/Get-MgGroupLifecyclePolicy.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgGroupLifecyclePolicy Cmdlet -```powershell -Import-Module Microsoft.Graph.Groups -Get-MgGroupLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId -``` -This example shows how to use the Get-MgGroupLifecyclePolicy Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgGroupLifecyclePolicy Cmdlet -```powershell -Import-Module Microsoft.Graph.Groups -Get-MgGroupLifecyclePolicy -``` -This example shows how to use the Get-MgGroupLifecyclePolicy Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Groups + +Get-MgGroupLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId +``` +This example shows how to use the Get-MgGroupLifecyclePolicy Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Groups/Groups/examples/v1.0-beta/New-MgGroupLifecyclePolicy.md b/src/Groups/Groups/examples/v1.0-beta/New-MgGroupLifecyclePolicy.md index c8c8d6981bc..d946d74f518 100644 --- a/src/Groups/Groups/examples/v1.0-beta/New-MgGroupLifecyclePolicy.md +++ b/src/Groups/Groups/examples/v1.0-beta/New-MgGroupLifecyclePolicy.md @@ -1,12 +1,15 @@ -### Example 1: Using the New-MgGroupLifecyclePolicy Cmdlet -```powershell -Import-Module Microsoft.Graph.Groups +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Groups + $params = @{ - GroupLifetimeInDays = 100 - ManagedGroupTypes = "Selected" - AlternateNotificationEmails = "admin@contoso.com" + groupLifetimeInDays = 100 + managedGroupTypes = "Selected" + alternateNotificationEmails = "admin@contoso.com" } -New-MgGroupLifecyclePolicy -BodyParameter $params -``` -This example shows how to use the New-MgGroupLifecyclePolicy Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgGroupLifecyclePolicy -BodyParameter $params +``` +This example shows how to use the New-MgGroupLifecyclePolicy Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Groups/Groups/examples/v1.0-beta/Remove-MgGroupLifecyclePolicy.md b/src/Groups/Groups/examples/v1.0-beta/Remove-MgGroupLifecyclePolicy.md index e35851c5eb5..c97e72096da 100644 --- a/src/Groups/Groups/examples/v1.0-beta/Remove-MgGroupLifecyclePolicy.md +++ b/src/Groups/Groups/examples/v1.0-beta/Remove-MgGroupLifecyclePolicy.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgGroupLifecyclePolicy Cmdlet -```powershell -Import-Module Microsoft.Graph.Groups -Remove-MgGroupLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId -``` -This example shows how to use the Remove-MgGroupLifecyclePolicy Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Groups + +Remove-MgGroupLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId +``` +This example shows how to use the Remove-MgGroupLifecyclePolicy Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Groups/Groups/examples/v1.0-beta/Update-MgGroupLifecyclePolicy.md b/src/Groups/Groups/examples/v1.0-beta/Update-MgGroupLifecyclePolicy.md index 5c1306ba208..b8f012c1717 100644 --- a/src/Groups/Groups/examples/v1.0-beta/Update-MgGroupLifecyclePolicy.md +++ b/src/Groups/Groups/examples/v1.0-beta/Update-MgGroupLifecyclePolicy.md @@ -1,12 +1,15 @@ -### Example 1: Using the Update-MgGroupLifecyclePolicy Cmdlet -```powershell -Import-Module Microsoft.Graph.Groups +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Groups + $params = @{ - GroupLifetimeInDays = 180 - ManagedGroupTypes = "Selected" - AlternateNotificationEmails = "admin@contoso.com" + groupLifetimeInDays = 180 + managedGroupTypes = "Selected" + alternateNotificationEmails = "admin@contoso.com" } -Update-MgGroupLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId -BodyParameter $params -``` -This example shows how to use the Update-MgGroupLifecyclePolicy Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgGroupLifecyclePolicy -GroupLifecyclePolicyId $groupLifecyclePolicyId -BodyParameter $params +``` +This example shows how to use the Update-MgGroupLifecyclePolicy Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgContract.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgContract.md index c2d402b792b..4422efae40f 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgContract.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgContract.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgContract Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgContract -ContractId $contractId -``` -This example shows how to use the Get-MgContract Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgContract Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgContract -``` -This example shows how to use the Get-MgContract Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Get-MgContract -ContractId $contractId +``` +This example shows how to use the Get-MgContract Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDevice.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDevice.md index c41183e4c53..9a2318b2935 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDevice.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDevice.md @@ -1,42 +1,18 @@ -### Example 1: Using the Get-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDevice -DeviceId $deviceId -``` -This example shows how to use the Get-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDevice -DeviceId $deviceId -Property "id,extensionAttributes" -``` -This example shows how to use the Get-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the Get-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDevice -Filter "extensionAttributes/extensionAttribute1 eq 'BYOD-Device'" -CountVariable CountVar -ConsistencyLevel eventual -``` -This example shows how to use the Get-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 4: Using the Get-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDevice -``` -This example shows how to use the Get-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 5: Using the Get-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDevice -Property "id,extensionAttributes" -``` -This example shows how to use the Get-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 6: Using the Get-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDevice -Filter "startswith(displayName, 'a')" -CountVariable CountVar -Top 1 -Sort "displayName" -ConsistencyLevel eventual -``` -This example shows how to use the Get-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Get a device + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Get-MgDevice -DeviceId $deviceId +``` +This example shows how to use the Get-MgDevice Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 2: Get a device and return only its id and extensionAttributes properties + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Get-MgDevice -DeviceId $deviceId -Property "id,extensionAttributes" +``` +This example shows how to use the Get-MgDevice Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDirectoryRoleTemplate.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDirectoryRoleTemplate.md index e8e27e057f0..f5847871613 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDirectoryRoleTemplate.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgDirectoryRoleTemplate.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgDirectoryRoleTemplate Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDirectoryRoleTemplate -DirectoryRoleTemplateId $directoryRoleTemplateId -``` -This example shows how to use the Get-MgDirectoryRoleTemplate Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgDirectoryRoleTemplate Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgDirectoryRoleTemplate -``` -This example shows how to use the Get-MgDirectoryRoleTemplate Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Get-MgDirectoryRoleTemplate -DirectoryRoleTemplateId $directoryRoleTemplateId +``` +This example shows how to use the Get-MgDirectoryRoleTemplate Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgOrganization.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgOrganization.md index bf1a20a58cb..c591970d6c0 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgOrganization.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Get-MgOrganization.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgOrganization Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgOrganization -OrganizationId $organizationId -``` -This example shows how to use the Get-MgOrganization Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgOrganization Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Get-MgOrganization -``` -This example shows how to use the Get-MgOrganization Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Get-MgOrganization -OrganizationId $organizationId +``` +This example shows how to use the Get-MgOrganization Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDevice.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDevice.md index 60fef51b1c8..00613937f80 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDevice.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDevice.md @@ -1,21 +1,23 @@ -### Example 1: Using the New-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + $params = @{ - AccountEnabled = $true - AlternativeSecurityIds = @( + accountEnabled = $false + alternativeSecurityIds = @( @{ - Type = 99 - IdentityProvider = "identityProvider-value" - Key = [System.Text.Encoding]::ASCII.GetBytes("base64Y3YxN2E1MWFlYw==") + type = 2 + key = [System.Text.Encoding]::ASCII.GetBytes("base64Y3YxN2E1MWFlYw==") } ) - ApproximateLastSignInDateTime = [System.DateTime]::Parse("2016-10-19T10:37:00Z") - DeviceId = "deviceId-value" - DeviceMetadata = "deviceMetadata-value" - DeviceVersion = 99 + deviceId = "4c299165-6e8f-4b45-a5ba-c5d250a707ff" + displayName = "Test device" + operatingSystem = "linux" + operatingSystemVersion = "1" } -New-MgDevice -BodyParameter $params -``` -This example shows how to use the New-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgDevice -BodyParameter $params +``` +This example shows how to use the New-MgDevice Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDirectoryRole.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDirectoryRole.md index 14ef0502506..6dba2a400be 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDirectoryRole.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDirectoryRole.md @@ -1,10 +1,13 @@ -### Example 1: Using the New-MgDirectoryRole Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + $params = @{ - RoleTemplateId = "fe930be7-5e62-47db-91af-98c3a49a38b1" + roleTemplateId = "fe930be7-5e62-47db-91af-98c3a49a38b1" } -New-MgDirectoryRole -BodyParameter $params -``` -This example shows how to use the New-MgDirectoryRole Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgDirectoryRole -BodyParameter $params +``` +This example shows how to use the New-MgDirectoryRole Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDomain.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDomain.md index f88d172ca2d..f6c6949389e 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDomain.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/New-MgDomain.md @@ -1,10 +1,17 @@ -### Example 1: Using the New-MgDomain Cmdlet +### Example 1: {{ Add title here }} ```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -$params = @{ - Id = "contoso.com" -} -New-MgDomain -BodyParameter $params + PS C:\> {{ Add code here }} + +{{ Add output here }} ``` -This example shows how to use the New-MgDomain Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell + PS C:\> {{ Add code here }} + +{{ Add output here }} +``` + +{{ Add description here }} diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDevice.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDevice.md index f95ac3817a5..4129ed662d0 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDevice.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDevice.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Remove-MgDevice -DeviceId $deviceId -``` -This example shows how to use the Remove-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Remove-MgDevice -DeviceId $deviceId +``` +This example shows how to use the Remove-MgDevice Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDomain.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDomain.md index 9a3adcac02e..cf060cd035f 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDomain.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Remove-MgDomain.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgDomain Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement -Remove-MgDomain -DomainId $domainId -``` -This example shows how to use the Remove-MgDomain Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Remove-MgDomain -DomainId $domainId +``` +This example shows how to use the Remove-MgDomain Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDevice.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDevice.md index b3cb724c543..f12d4d22d39 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDevice.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDevice.md @@ -1,22 +1,25 @@ -### Example 1: Using the Update-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement +### Example 1: Update the accountEnabled property of a device + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + $params = @{ - ExtensionAttributes = @{ - ExtensionAttribute1 = "BYOD-Device" - } + accountEnabled = $false } -Update-MgDevice -DeviceId $deviceId -BodyParameter $params -``` -This example shows how to use the Update-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Update-MgDevice Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement + +Update-MgDevice -DeviceId $deviceId -BodyParameter $params +``` +This example shows how to use the Update-MgDevice Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 2: Write extensionAttributes on a device + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + $params = @{ - AccountEnabled = $false } -Update-MgDevice -DeviceId $deviceId -BodyParameter $params -``` -This example shows how to use the Update-MgDevice Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgDevice -DeviceId $deviceId -BodyParameter $params +``` +This example shows how to use the Update-MgDevice Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDomain.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDomain.md index 1ff91394b8f..a3e682f52ca 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDomain.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgDomain.md @@ -1,14 +1,17 @@ -### Example 1: Using the Update-MgDomain Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + $params = @{ - IsDefault = $true - SupportedServices = @( + isDefault = $true + supportedServices = @( "Email" "OfficeCommunicationsOnline" ) } -Update-MgDomain -DomainId $domainId -BodyParameter $params -``` -This example shows how to use the Update-MgDomain Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgDomain -DomainId $domainId -BodyParameter $params +``` +This example shows how to use the Update-MgDomain Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgOrganization.md b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgOrganization.md index 5e266c3d37d..cc125809fc9 100644 --- a/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgOrganization.md +++ b/src/Identity.DirectoryManagement/Identity.DirectoryManagement/examples/v1.0-beta/Update-MgOrganization.md @@ -1,25 +1,28 @@ -### Example 1: Using the Update-MgOrganization Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.DirectoryManagement +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.DirectoryManagement + $params = @{ - MarketingNotificationEmails = @( + marketingNotificationEmails = @( "marketing@contoso.com" ) - PrivacyProfile = @{ - ContactEmail = "alice@contoso.com" - StatementUrl = "https://contoso.com/privacyStatement" + privacyProfile = @{ + contactEmail = "alice@contoso.com" + statementUrl = "https://contoso.com/privacyStatement" } - SecurityComplianceNotificationMails = @( + securityComplianceNotificationMails = @( "security@contoso.com" ) - SecurityComplianceNotificationPhones = @( + securityComplianceNotificationPhones = @( "(123) 456-7890" ) - TechnicalNotificationMails = @( + technicalNotificationMails = @( "tech@contoso.com" ) } -Update-MgOrganization -OrganizationId $organizationId -BodyParameter $params -``` -This example shows how to use the Update-MgOrganization Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgOrganization -OrganizationId $organizationId -BodyParameter $params +``` +This example shows how to use the Update-MgOrganization Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgDataPolicyOperation.md b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgDataPolicyOperation.md index af06a44cfe9..f0a41356992 100644 --- a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgDataPolicyOperation.md +++ b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgDataPolicyOperation.md @@ -1,7 +1,9 @@ -### Example 1: Using the Get-MgDataPolicyOperation Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.SignIns -Get-MgDataPolicyOperation -DataPolicyOperationId $dataPolicyOperationId -``` -This example shows how to use the Get-MgDataPolicyOperation Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.SignIns + +Get-MgDataPolicyOperation -DataPolicyOperationId $dataPolicyOperationId +``` +This example shows how to use the Get-MgDataPolicyOperation Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgOauth2PermissionGrant.md b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgOauth2PermissionGrant.md index 6886116e856..0d8159bf907 100644 --- a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgOauth2PermissionGrant.md +++ b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Get-MgOauth2PermissionGrant.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgOauth2PermissionGrant Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.SignIns -Get-MgOauth2PermissionGrant -OAuth2PermissionGrantId $oAuth2PermissionGrantId -``` -This example shows how to use the Get-MgOauth2PermissionGrant Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgOauth2PermissionGrant Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.SignIns -Get-MgOauth2PermissionGrant -``` -This example shows how to use the Get-MgOauth2PermissionGrant Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.SignIns + +Get-MgOauth2PermissionGrant -OAuth2PermissionGrantId $oAuth2PermissionGrantId +``` +This example shows how to use the Get-MgOauth2PermissionGrant Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgInvitation.md b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgInvitation.md index 89c419d5606..303f7f3b02e 100644 --- a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgInvitation.md +++ b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgInvitation.md @@ -3,8 +3,8 @@ ```powershell Import-Module Microsoft.Graph.Identity.SignIns $params = @{ - InvitedUserEmailAddress = "admin@fabrikam.com" - InviteRedirectUrl = "https://myapp.contoso.com" + invitedUserEmailAddress = "admin@fabrikam.com" + inviteRedirectUrl = "https://myapp.contoso.com" } New-MgInvitation -BodyParameter $params diff --git a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgOauth2PermissionGrant.md b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgOauth2PermissionGrant.md index 092a9c0a9b4..458f9c11fa9 100644 --- a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgOauth2PermissionGrant.md +++ b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/New-MgOauth2PermissionGrant.md @@ -1,15 +1,16 @@ -### Example 1: Using the New-MgOauth2PermissionGrant Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.SignIns +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.SignIns + $params = @{ - ClientId = "ef969797-201d-4f6b-960c-e9ed5f31dab5" - ConsentType = "AllPrincipals" - ResourceId = "943603e4-e787-4fe9-93d1-e30f749aae39" - Scope = "DelegatedPermissionGrant.ReadWrite.All" - StartTime = [System.DateTime]::Parse("2022-03-17T00:00:00Z") - ExpiryTime = [System.DateTime]::Parse("2023-03-17T00:00:00Z") + clientId = "ef969797-201d-4f6b-960c-e9ed5f31dab5" + consentType = "AllPrincipals" + resourceId = "943603e4-e787-4fe9-93d1-e30f749aae39" + scope = "DelegatedPermissionGrant.ReadWrite.All" } -New-MgOauth2PermissionGrant -BodyParameter $params -``` -This example shows how to use the New-MgOauth2PermissionGrant Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgOauth2PermissionGrant -BodyParameter $params +``` +This example shows how to use the New-MgOauth2PermissionGrant Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Remove-MgOauth2PermissionGrant.md b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Remove-MgOauth2PermissionGrant.md index 9b181d80bb5..0365dbde265 100644 --- a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Remove-MgOauth2PermissionGrant.md +++ b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Remove-MgOauth2PermissionGrant.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgOauth2PermissionGrant Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.SignIns -Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId $oAuth2PermissionGrantId -``` -This example shows how to use the Remove-MgOauth2PermissionGrant Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.SignIns + +Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId $oAuth2PermissionGrantId +``` +This example shows how to use the Remove-MgOauth2PermissionGrant Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Update-MgOauth2PermissionGrant.md b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Update-MgOauth2PermissionGrant.md index 7a1f2d7b0e7..4e8fca01789 100644 --- a/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Update-MgOauth2PermissionGrant.md +++ b/src/Identity.SignIns/Identity.SignIns/examples/v1.0-beta/Update-MgOauth2PermissionGrant.md @@ -1,10 +1,13 @@ -### Example 1: Using the Update-MgOauth2PermissionGrant Cmdlet -```powershell -Import-Module Microsoft.Graph.Identity.SignIns +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Identity.SignIns + $params = @{ - Scope = "User.ReadBasic.All Group.ReadWrite.All" + scope = "User.ReadBasic.All Group.ReadWrite.All" } -Update-MgOauth2PermissionGrant -OAuth2PermissionGrantId $oAuth2PermissionGrantId -BodyParameter $params -``` -This example shows how to use the Update-MgOauth2PermissionGrant Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgOauth2PermissionGrant -OAuth2PermissionGrantId $oAuth2PermissionGrantId -BodyParameter $params +``` +This example shows how to use the Update-MgOauth2PermissionGrant Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Get-MgSchemaExtension.md b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Get-MgSchemaExtension.md index 463677ebfe3..b40fa380b9e 100644 --- a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Get-MgSchemaExtension.md +++ b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Get-MgSchemaExtension.md @@ -1,14 +1,9 @@ -### Example 1: Using the Get-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions -Get-MgSchemaExtension -SchemaExtensionId $schemaExtensionId -``` -This example shows how to use the Get-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions -Get-MgSchemaExtension -Filter "id eq 'graphlearn_test'" -``` -This example shows how to use the Get-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.SchemaExtensions + +Get-MgSchemaExtension -SchemaExtensionId $schemaExtensionId +``` +This example shows how to use the Get-MgSchemaExtension Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/New-MgSchemaExtension.md b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/New-MgSchemaExtension.md index 369d52f1ca4..d3477495995 100644 --- a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/New-MgSchemaExtension.md +++ b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/New-MgSchemaExtension.md @@ -1,85 +1,94 @@ -### Example 1: Using the New-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions +### Example 1: Creating a schema extension using a verified domain + +```powershell Import-Module Microsoft.Graph.SchemaExtensions + $params = @{ - Id = "graphlearn_courses" - Description = "Graph Learn training courses extensions" - TargetTypes = @( + id = "graphlearn_courses" + description = "Graph Learn training courses extensions" + targetTypes = @( "Group" ) - Properties = @( + properties = @( @{ - Name = "courseId" - Type = "Integer" + name = "courseId" + type = "Integer" } @{ - Name = "courseName" - Type = "String" + name = "courseName" + type = "String" } @{ - Name = "courseType" - Type = "String" + name = "courseType" + type = "String" } ) } -New-MgSchemaExtension -BodyParameter $params -``` -This example shows how to use the New-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the New-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions + +New-MgSchemaExtension -BodyParameter $params +``` +This example shows how to use the New-MgSchemaExtension Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 2: Creating a schema extension using just a name + +```powershell Import-Module Microsoft.Graph.SchemaExtensions + $params = @{ - Id = "courses" - Description = "Graph Learn training courses extensions" - TargetTypes = @( + id = "courses" + description = "Graph Learn training courses extensions" + targetTypes = @( "Group" ) - Properties = @( + properties = @( @{ - Name = "courseId" - Type = "Integer" + name = "courseId" + type = "Integer" } @{ - Name = "courseName" - Type = "String" + name = "courseName" + type = "String" } @{ - Name = "courseType" - Type = "String" + name = "courseType" + type = "String" } ) } -New-MgSchemaExtension -BodyParameter $params -``` -This example shows how to use the New-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the New-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions + +New-MgSchemaExtension -BodyParameter $params +``` +This example shows how to use the New-MgSchemaExtension Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 3: Creating a schema extension setting the owner + +```powershell Import-Module Microsoft.Graph.SchemaExtensions + $params = @{ - Id = "courses" - Description = "Graph Learn training courses extensions" - TargetTypes = @( + id = "courses" + description = "Graph Learn training courses extensions" + targetTypes = @( "Group" ) - Owner = "50897f70-a455-4adf-87bc-4cf17091d5ac" - Properties = @( + owner = "50897f70-a455-4adf-87bc-4cf17091d5ac" + properties = @( @{ - Name = "courseId" - Type = "Integer" + name = "courseId" + type = "Integer" } @{ - Name = "courseName" - Type = "String" + name = "courseName" + type = "String" } @{ - Name = "courseType" - Type = "String" + name = "courseType" + type = "String" } ) } -New-MgSchemaExtension -BodyParameter $params -``` -This example shows how to use the New-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgSchemaExtension -BodyParameter $params +``` +This example shows how to use the New-MgSchemaExtension Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Remove-MgSchemaExtension.md b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Remove-MgSchemaExtension.md index 5fbf9f8da95..b26a308449c 100644 --- a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Remove-MgSchemaExtension.md +++ b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Remove-MgSchemaExtension.md @@ -1,7 +1,9 @@ -### Example 1: Using the Remove-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions -Remove-MgSchemaExtension -SchemaExtensionId $schemaExtensionId -``` -This example shows how to use the Remove-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.SchemaExtensions + +Remove-MgSchemaExtension -SchemaExtensionId $schemaExtensionId +``` +This example shows how to use the Remove-MgSchemaExtension Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Update-MgSchemaExtension.md b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Update-MgSchemaExtension.md index 961a8eb0e44..b580c68686f 100644 --- a/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Update-MgSchemaExtension.md +++ b/src/SchemaExtensions/SchemaExtensions/examples/v1.0-beta/Update-MgSchemaExtension.md @@ -1,56 +1,31 @@ -### Example 1: Using the Update-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.SchemaExtensions + $params = @{ - Owner = "ef4cb9a8-97c3-4ca7-854b-5cb5ced376fa" - Properties = @( + owner = "ef4cb9a8-97c3-4ca7-854b-5cb5ced376fa" + properties = @( @{ - Name = "courseId" - Type = "Integer" + name = "courseId" + type = "Integer" } @{ - Name = "courseName" - Type = "String" + name = "courseName" + type = "String" } @{ - Name = "courseType" - Type = "String" + name = "courseType" + type = "String" } @{ - Name = "courseSupervisors" - Type = "String" + name = "courseSupervisors" + type = "String" } ) } -Update-MgSchemaExtension -SchemaExtensionId $schemaExtensionId -BodyParameter $params -``` -This example shows how to use the Update-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Update-MgSchemaExtension Cmdlet -```powershell -Import-Module Microsoft.Graph.SchemaExtensions -$params = @{ - Owner = "ef4cb9a8-97c3-4ca7-854b-5cb5ced376fa" - Properties = @( - @{ - Name = "courseId" - Type = "Integer" - } - @{ - Name = "courseName" - Type = "String" - } - @{ - Name = "courseType" - Type = "String" - } - @{ - Name = "courseSupervisors" - Type = "String" - } - ) -} -Update-MgSchemaExtension -SchemaExtensionId $schemaExtensionId -BodyParameter $params -``` -This example shows how to use the Update-MgSchemaExtension Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgSchemaExtension -SchemaExtensionId $schemaExtensionId -BodyParameter $params +``` +This example shows how to use the Update-MgSchemaExtension Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Sites/Sites/examples/v1.0-beta/Get-MgSite.md b/src/Sites/Sites/examples/v1.0-beta/Get-MgSite.md index bece80c7c30..c00ee4de9ed 100644 --- a/src/Sites/Sites/examples/v1.0-beta/Get-MgSite.md +++ b/src/Sites/Sites/examples/v1.0-beta/Get-MgSite.md @@ -1,42 +1,9 @@ -### Example 1: Using the Get-MgSite Cmdlet -```powershell -Import-Module Microsoft.Graph.Sites -Get-MgSite -``` -This example shows how to use the Get-MgSite Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgSite Cmdlet -```powershell -Import-Module Microsoft.Graph.Sites -Get-MgSite -SiteId $siteId -``` -This example shows how to use the Get-MgSite Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the Get-MgSite Cmdlet -```powershell -Import-Module Microsoft.Graph.Sites -Get-MgSite -Search "{query}" -OutFile $outFileId -``` -This example shows how to use the Get-MgSite Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 4: Using the Get-MgSite Cmdlet -```powershell -Import-Module Microsoft.Graph.Sites -Get-MgSite -Search "{query}" -``` -This example shows how to use the Get-MgSite Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 5: Using the Get-MgSite Cmdlet -```powershell -Import-Module Microsoft.Graph.Sites -Get-MgSite -Property "siteCollection,webUrl" -Filter "siteCollection/root ne null" -``` -This example shows how to use the Get-MgSite Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 6: Using the Get-MgSite Cmdlet -```powershell -Import-Module Microsoft.Graph.Sites -Get-MgSite -OutFile $outFileId -``` -This example shows how to use the Get-MgSite Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Sites + +Get-MgSite -SiteId $siteId +``` +This example shows how to use the Get-MgSite Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Teams/Teams/examples/v1.0-beta/Get-MgChat.md b/src/Teams/Teams/examples/v1.0-beta/Get-MgChat.md index b23c9eb41cb..e2148cc5583 100644 --- a/src/Teams/Teams/examples/v1.0-beta/Get-MgChat.md +++ b/src/Teams/Teams/examples/v1.0-beta/Get-MgChat.md @@ -1,35 +1,44 @@ -### Example 1: Using the Get-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -Get-MgChat -ChatId $chatId -ExpandProperty "members" -``` -This example shows how to use the Get-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgChat Cmdlet +### Example 1: Get a group chat + ```powershell Import-Module Microsoft.Graph.Teams + Get-MgChat -ChatId $chatId ``` This example shows how to use the Get-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the Get-MgChat Cmdlet + +### Example 2: Get a chat and all its members + ```powershell Import-Module Microsoft.Graph.Teams -Get-MgChat -ChatId $chatId + +Get-MgChat -ChatId $chatId -ExpandProperty "members" ``` This example shows how to use the Get-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 4: Using the Get-MgChat Cmdlet + +### Example 3: Get the meeting details of a chat associated with a Microsoft Teams meeting + ```powershell Import-Module Microsoft.Graph.Teams -Get-MgChat -ExpandProperty "lastMessagePreview" + +Get-MgChat -ChatId $chatId ``` This example shows how to use the Get-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 5: Using the Get-MgChat Cmdlet + +### Example 4: Get the chat along with the preview of the last message sent in the chat + ```powershell Import-Module Microsoft.Graph.Teams -Get-MgChat -Sort "lastMessagePreview/createdDateTime desc" + +Get-MgChat -ChatId $chatId -ExpandProperty "lastMessagePreview" ``` This example shows how to use the Get-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Teams/Teams/examples/v1.0-beta/Get-MgTeam.md b/src/Teams/Teams/examples/v1.0-beta/Get-MgTeam.md index 07f90af094c..fe10ef0b010 100644 --- a/src/Teams/Teams/examples/v1.0-beta/Get-MgTeam.md +++ b/src/Teams/Teams/examples/v1.0-beta/Get-MgTeam.md @@ -1,35 +1,9 @@ -### Example 1: Using the Get-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -Get-MgTeam -TeamId $teamId -``` -This example shows how to use the Get-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the Get-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -Get-MgTeam -Filter "displayName eq 'A Contoso Team'" -Property "id,description" -``` -This example shows how to use the Get-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the Get-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -Get-MgTeam -Filter "startswith(displayName, 'A')" -Top 2 -``` -This example shows how to use the Get-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 4: Using the Get-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -Get-MgTeam -``` -This example shows how to use the Get-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 5: Using the Get-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -Get-MgTeam -Filter "displayName eq 'A Contoso Team'" -Property "id,description" -OutFile $outFileId -``` -This example shows how to use the Get-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + +Get-MgTeam -TeamId $teamId +``` +This example shows how to use the Get-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Teams/Teams/examples/v1.0-beta/New-MgChat.md b/src/Teams/Teams/examples/v1.0-beta/New-MgChat.md index 2b12d55cd67..b984ddb9d2b 100644 --- a/src/Teams/Teams/examples/v1.0-beta/New-MgChat.md +++ b/src/Teams/Teams/examples/v1.0-beta/New-MgChat.md @@ -1,212 +1,162 @@ -### Example 1: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams +### Example 1: Create a one-on-one chat + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - ChatType = "group" - Topic = "Group chat title" - Members = @( + chatType = "oneOnOne" + members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')" } @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')" - } - @{ - "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "owner" - ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('3626a173-f2bc-4883-bcf7-01514c3bfb82')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('82af01c5-f7cc-4a2e-a728-3a5df21afd9d')" } ) } -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgChat -BodyParameter $params +``` +This example shows how to use the New-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 2: Create a group chat + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - ChatType = "group" - Topic = "Group chat title" - Members = @( - @{ - "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "owner" - ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')" - } + chatType = "group" + topic = "Group chat title" + members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')" } @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "guest" - ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8ba98gf6-7fc2-4eb2-c7f2-aef9f21fd98g')" - } - ) -} -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -$params = @{ - ChatType = "group" - Topic = "Group chat title" - Members = @( - @{ - "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')" } @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')" - } - @{ - "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "guest" - ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8ba98gf6-7fc2-4eb2-c7f2-aef9f21fd98g')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('3626a173-f2bc-4883-bcf7-01514c3bfb82')" } ) } -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 4: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgChat -BodyParameter $params +``` +This example shows how to use the New-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 3: Create a one-on-one chat using user principal name + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - ChatType = "oneOnOne" - Members = @( + chatType = "oneOnOne" + members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/v1.0/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')" } @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/v1.0/users('82af01c5-f7cc-4a2e-a728-3a5df21afd9d')" - TenantId = "4dc1fe35-8ac6-4f0d-904a-7ebcd364bea1" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('alex@contoso.com')" } ) } -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 5: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgChat -BodyParameter $params +``` +This example shows how to use the New-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 4: Create a group chat with tenant guest user + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - ChatType = "oneOnOne" - Members = @( - @{ - "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "owner" - ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')" - } + chatType = "group" + topic = "Group chat title" + members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('82af01c5-f7cc-4a2e-a728-3a5df21afd9d')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('8c0a1a67-50ce-4114-bb6c-da9c5dbcf6ca')" } - ) -} -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 6: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -$params = @{ - ChatType = "oneOnOne" - Members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('jacob@contoso.com')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('82fe7758-5bb3-4f0d-a43f-e555fd399c6f')" } @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "owner" + roles = @( + "guest" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('alex@contoso.com')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('8ba98gf6-7fc2-4eb2-c7f2-aef9f21fd98g')" } ) } -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 7: Using the New-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgChat -BodyParameter $params +``` +This example shows how to use the New-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 5: Create a one-on-one chat with a federated user (outside of own organization) + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - ChatType = "oneOnOne" - Members = @( + chatType = "oneOnOne" + members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')" } @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('82af01c5-f7cc-4a2e-a728-3a5df21afd9d')" - } - ) - InstalledApps = @( - @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/beta/appCatalogs/teamsApps/05F59CEC-A742-4A50-A62E-202A57E478A4" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('82af01c5-f7cc-4a2e-a728-3a5df21afd9d')" + tenantId = "4dc1fe35-8ac6-4f0d-904a-7ebcd364bea1" } ) } -New-MgChat -BodyParameter $params -``` -This example shows how to use the New-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgChat -BodyParameter $params +``` +This example shows how to use the New-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Teams/Teams/examples/v1.0-beta/New-MgTeam.md b/src/Teams/Teams/examples/v1.0-beta/New-MgTeam.md index 4a0770b90bd..ae304e4fb59 100644 --- a/src/Teams/Teams/examples/v1.0-beta/New-MgTeam.md +++ b/src/Teams/Teams/examples/v1.0-beta/New-MgTeam.md @@ -1,236 +1,257 @@ -### Example 1: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('standard')" - "Group@odata.bind" = "https://graph.microsoft.com/beta/groups('dbd8de4f-5d47-48da-87f1-594bed003375')" - Channels = @( + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" + displayName = "My Sample Team" + description = "My Sample Team???s Description" +} + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 2: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + +$params = @{ + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" + displayName = "My Sample Team" + description = "My Sample Team???s Description" + members = @( @{ - DisplayName = "Class Announcements 📢" - IsFavoriteByDefault = $true + "@odata.type" = "#microsoft.graph.aadUserConversationMember" + roles = @( + "owner" + ) + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('0040b377-61d8-43db-94f5-81374122dc7e')" } + ) +} + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 3: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + +$params = @{ + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" + visibility = "Private" + displayName = "Sample Engineering Team" + description = "This is a sample engineering team, used to showcase the range of properties supported by this API" + channels = @( @{ - DisplayName = "Homework ðŸ‹ï¸" - IsFavoriteByDefault = $true + displayName = "Announcements ????" + isFavoriteByDefault = $true + description = "This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements." + } + @{ + displayName = "Training ???????" + isFavoriteByDefault = $true + description = "This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs." + tabs = @( + @{ + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')" + displayName = "A Pinned Website" + configuration = @{ + contentUrl = "https://learn.microsoft.com/microsoftteams/microsoft-teams" + } + } + @{ + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')" + displayName = "A Pinned YouTube Video" + configuration = @{ + contentUrl = "https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ" + websiteUrl = "https://www.youtube.com/watch?v=X8krAMdGvCQ" + } + } + ) + } + @{ + displayName = "Planning ???? " + description = "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu." + isFavoriteByDefault = $false + } + @{ + displayName = "Issues and Feedback ????" + description = "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu." } ) - MemberSettings = @{ - AllowCreateUpdateChannels = $false - AllowDeleteChannels = $false - AllowAddRemoveApps = $false - AllowCreateUpdateRemoveTabs = $false - AllowCreateUpdateRemoveConnectors = $false + memberSettings = @{ + allowCreateUpdateChannels = $true + allowDeleteChannels = $true + allowAddRemoveApps = $true + allowCreateUpdateRemoveTabs = $true + allowCreateUpdateRemoveConnectors = $true + } + guestSettings = @{ + allowCreateUpdateChannels = $false + allowDeleteChannels = $false } - InstalledApps = @( + funSettings = @{ + allowGiphy = $true + giphyContentRating = "Moderate" + allowStickersAndMemes = $true + allowCustomMemes = $true + } + messagingSettings = @{ + allowUserEditMessages = $true + allowUserDeleteMessages = $true + allowOwnerDeleteMessages = $true + allowTeamMentions = $true + allowChannelMentions = $true + } + installedApps = @( @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')" + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')" } @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')" + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')" } ) } -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 2: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 4: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('educationClass')" - DisplayName = "My Class Team" - Description = "My Class Team’s Description" + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" + "group@odata.bind" = "https://graph.microsoft.com/v1.0/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')" } -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 3: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 5: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('educationClass')" - DisplayName = "My Class Team" - Description = "My Class Team’s Description" - Channels = @( + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" + "group@odata.bind" = "https://graph.microsoft.com/v1.0/groups('dbd8de4f-5d47-48da-87f1-594bed003375')" + channels = @( @{ - DisplayName = "Class Announcements 📢" - IsFavoriteByDefault = $true + displayName = "Class Announcements ????" + isFavoriteByDefault = $true } @{ - DisplayName = "Homework ðŸ‹ï¸" - IsFavoriteByDefault = $true + displayName = "Homework ???????" + isFavoriteByDefault = $true } ) - MemberSettings = @{ - AllowCreateUpdateChannels = $false - AllowDeleteChannels = $false - AllowAddRemoveApps = $false - AllowCreateUpdateRemoveTabs = $false - AllowCreateUpdateRemoveConnectors = $false + memberSettings = @{ + allowCreateUpdateChannels = $false + allowDeleteChannels = $false + allowAddRemoveApps = $false + allowCreateUpdateRemoveTabs = $false + allowCreateUpdateRemoveConnectors = $false } - InstalledApps = @( + installedApps = @( @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')" + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')" } @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')" + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')" } ) } -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 4: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 6: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('standard')" - "Group@odata.bind" = "https://graph.microsoft.com/beta/groups('71392b2f-1765-406e-86af-5907d9bdb2ab')" + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')" + displayName = "My Class Team" + description = "My Class Team???s Description" } -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 5: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 7: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('standard')" - Visibility = "Private" - DisplayName = "Sample Engineering Team" - Description = "This is a sample engineering team, used to showcase the range of properties supported by this API" - Channels = @( + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')" + displayName = "My Class Team" + description = "My Class Team???s Description" + channels = @( @{ - DisplayName = "Announcements 📢" - IsFavoriteByDefault = $true - Description = "This is a sample announcements channel that is favorited by default. Use this channel to make important team, product, and service announcements." + displayName = "Class Announcements ????" + isFavoriteByDefault = $true } @{ - DisplayName = "Training ðŸ‹ï¸" - IsFavoriteByDefault = $true - Description = "This is a sample training channel, that is favorited by default, and contains an example of pinned website and YouTube tabs." - Tabs = @( - @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.web')" - DisplayName = "A Pinned Website" - Configuration = @{ - ContentUrl = "https://docs.microsoft.com/microsoftteams/microsoft-teams" - } - } - @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.youtube')" - DisplayName = "A Pinned YouTube Video" - Configuration = @{ - ContentUrl = "https://tabs.teams.microsoft.com/Youtube/Home/YoutubeTab?videoId=X8krAMdGvCQ" - WebsiteUrl = "https://www.youtube.com/watch?v=X8krAMdGvCQ" - } - } - ) - } - @{ - DisplayName = "Planning 📅 " - Description = "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu." - IsFavoriteByDefault = $false - } - @{ - DisplayName = "Issues and Feedback ðŸž" - Description = "This is a sample of a channel that is not favorited by default, these channels will appear in the more channels overflow menu." + displayName = "Homework ???????" + isFavoriteByDefault = $true } ) - MemberSettings = @{ - AllowCreateUpdateChannels = $true - AllowDeleteChannels = $true - AllowAddRemoveApps = $true - AllowCreateUpdateRemoveTabs = $true - AllowCreateUpdateRemoveConnectors = $true - } - GuestSettings = @{ - AllowCreateUpdateChannels = $false - AllowDeleteChannels = $false - } - FunSettings = @{ - AllowGiphy = $true - GiphyContentRating = "Moderate" - AllowStickersAndMemes = $true - AllowCustomMemes = $true + memberSettings = @{ + allowCreateUpdateChannels = $false + allowDeleteChannels = $false + allowAddRemoveApps = $false + allowCreateUpdateRemoveTabs = $false + allowCreateUpdateRemoveConnectors = $false } - MessagingSettings = @{ - AllowUserEditMessages = $true - AllowUserDeleteMessages = $true - AllowOwnerDeleteMessages = $true - AllowTeamMentions = $true - AllowChannelMentions = $true - } - DiscoverySettings = @{ - ShowInTeamsSearchAndSuggestions = $true - } - InstalledApps = @( - @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')" - } + installedApps = @( @{ - "TeamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')" + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('com.microsoft.teamspace.tab.vsts')" } - ) -} -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 6: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -$params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('standard')" - DisplayName = "My Sample Team" - Description = "My Sample Team’s Description" - Members = @( @{ - "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( - "owner" - ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('0040b377-61d8-43db-94f5-81374122dc7e')" + "teamsApp@odata.bind" = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps('1542629c-01b3-4a6d-8f76-1938b779e48d')" } ) } -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 7: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams -$params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('standard')" - DisplayName = "My Sample Team" - Description = "My Sample Team’s Description" -} -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). -### Example 8: Using the New-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +### Example 8: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - "Template@odata.bind" = "https://graph.microsoft.com/beta/teamsTemplates('standard')" - DisplayName = "My Sample Team" - Description = "My Sample Team’s Description" - Members = @( + "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" + displayName = "My Sample Team" + description = "My Sample Team???s Description" + members = @( @{ "@odata.type" = "#microsoft.graph.aadUserConversationMember" - Roles = @( + roles = @( "owner" ) - "User@odata.bind" = "https://graph.microsoft.com/beta/users('jacob@contoso.com')" + "user@odata.bind" = "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')" } ) } -New-MgTeam -BodyParameter $params -``` -This example shows how to use the New-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +New-MgTeam -BodyParameter $params +``` +This example shows how to use the New-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Teams/Teams/examples/v1.0-beta/Update-MgChat.md b/src/Teams/Teams/examples/v1.0-beta/Update-MgChat.md index 7d3d89e4caf..332cc75c2b0 100644 --- a/src/Teams/Teams/examples/v1.0-beta/Update-MgChat.md +++ b/src/Teams/Teams/examples/v1.0-beta/Update-MgChat.md @@ -1,10 +1,13 @@ -### Example 1: Using the Update-MgChat Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - Topic = "Group chat title update" + topic = "Group chat title update" } -Update-MgChat -ChatId $chatId -BodyParameter $params -``` -This example shows how to use the Update-MgChat Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgChat -ChatId $chatId -BodyParameter $params +``` +This example shows how to use the Update-MgChat Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + diff --git a/src/Teams/Teams/examples/v1.0-beta/Update-MgTeam.md b/src/Teams/Teams/examples/v1.0-beta/Update-MgTeam.md index a717cb3ca28..41638a9e200 100644 --- a/src/Teams/Teams/examples/v1.0-beta/Update-MgTeam.md +++ b/src/Teams/Teams/examples/v1.0-beta/Update-MgTeam.md @@ -1,24 +1,23 @@ -### Example 1: Using the Update-MgTeam Cmdlet -```powershell -Import-Module Microsoft.Graph.Teams +### Example 1: Code snippet + +```powershell Import-Module Microsoft.Graph.Teams + $params = @{ - IsMembershipLimitedToOwners = $true - MemberSettings = @{ - AllowCreateUpdateChannels = $true + memberSettings = @{ + allowCreateUpdateChannels = $true } - MessagingSettings = @{ - AllowUserEditMessages = $true - AllowUserDeleteMessages = $true + messagingSettings = @{ + allowUserEditMessages = $true + allowUserDeleteMessages = $true } - FunSettings = @{ - AllowGiphy = $true - GiphyContentRating = "strict" - } - DiscoverySettings = @{ - ShowInTeamsSearchAndSuggestions = $true + funSettings = @{ + allowGiphy = $true + giphyContentRating = "strict" } } -Update-MgTeam -TeamId $teamId -BodyParameter $params -``` -This example shows how to use the Update-MgTeam Cmdlet. -To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). + +Update-MgTeam -TeamId $teamId -BodyParameter $params +``` +This example shows how to use the Update-MgTeam Cmdlet. + To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference). +