@@ -332,6 +332,11 @@ function Update-ExampleFile {
332332 $Code = " `````` powershell`r $CodeValue `r`n`````` "
333333
334334 $TotalText = " $TitleValue `r`n`n $Code `r`n $Description `r`n "
335+ if ($GraphProfile -eq " beta" ){
336+ # Replace examples to match the new beta naming convention
337+ $TotalText = $TotalText.Replace (" -Mg" , " -MgBeta" )
338+ $TotalText = $TotalText.Replace (" Microsoft.Graph" , " Microsoft.Graph.Beta" )
339+ }
335340 Add-Content - Path $ExampleFile - Value $TotalText
336341 }else {
337342 $WrongExamplesCount ++
@@ -340,9 +345,6 @@ function Update-ExampleFile {
340345 }
341346 }
342347 $PatternToSearch = " Import-Module Microsoft.Graph.$Module "
343- if ($GraphProfile -eq " beta" ){
344- $PatternToSearch = " Import-Module Microsoft.Graph.Beta.$Module "
345- }
346348 if (($Content | Select-String - pattern $SearchText ) -and ($Content | Select-String - pattern " This example shows" )){
347349 $ContainsPatternToSearch = $False
348350 foreach ($List in $ExampleList ){
@@ -359,6 +361,11 @@ function Update-ExampleFile {
359361 $Code = " `````` powershell`r $CodeValue `r`n`````` "
360362
361363 $TotalText = " $TitleValue `r`n`n $Code `r`n $Description `r`n "
364+ if ($GraphProfile -eq " beta" ){
365+ # Replace examples to match the new beta naming convention
366+ $TotalText = $TotalText.Replace (" -Mg" , " -MgBeta" )
367+ $TotalText = $TotalText.Replace (" Microsoft.Graph" , " Microsoft.Graph.Beta" )
368+ }
362369 Add-Content - Path $ExampleFile - Value $TotalText
363370 }
364371
@@ -447,6 +454,9 @@ Start-Generator -ModulesToGenerate $ModulesToGenerate -GenerationMode "auto"
447454# 2. Test for ensuring that a handwritten example is not tampered with
448455# Start-Generator -GenerationMode "manual" -ManualExternalDocsUrl "https://docs.microsoft.com/graph/api/user-get?view=graph-rest-1.0" -GraphCommand "Get-MgUser" -GraphModule "Users" -Profile "v1.0"
449456
450- # 3. Test for updates from api reference
451- # Start-Generator -GenerationMode "manual" -ManualExternalDocsUrl "https://docs.microsoft.com/graph/api/serviceprincipal-post-approleassignedto?view=graph-rest-1.0" -GraphCommand "New-MgServicePrincipalAppRoleAssignedTo" -GraphModule "Applications" -Profile "v1.0"
452- Write-Host - ForegroundColor Green " -------------Done-------------"
457+ # 3. Test for v1.0 updates from api reference
458+ # Start-Generator -GenerationMode "manual" -ManualExternalDocsUrl "https://docs.microsoft.com/graph/api/serviceprincipal-post-approleassignedto?view=graph-rest-v1.0" -GraphCommand "New-MgServicePrincipalAppRoleAssignedTo" -GraphModule "Applications" -Profile "v1.0"
459+
460+ # 4. Test for beta updates from api reference
461+ # Start-Generator -GenerationMode "manual" -ManualExternalDocsUrl "https://docs.microsoft.com/graph/api/serviceprincipal-post-approleassignedto?view=graph-rest-beta" -GraphCommand "New-MgBetaServicePrincipalAppRoleAssignedTo" -GraphModule "Applications" -Profile "beta"
462+ # Write-Host -ForegroundColor Green "-------------Done-------------"
0 commit comments