@@ -143,15 +143,15 @@ function Construct-Path {
143
143
if (Test-Path $BetaFilePath ) {
144
144
$V1Command = $Command.Replace (" -MgBeta" , " -Mg" )
145
145
$ConfirmV1Path = Join-Path $WorkLoadDocsPath " graph-powershell-1.0" " Microsoft.Graph.$Module " " $V1Command .md"
146
- if (Test-Path $ConfirmV1Path ){
146
+ if (Test-Path $ConfirmV1Path ) {
147
147
Add-Link - File $BetaFilePath - Module $Module - GraphProfile " beta" - Command $Command
148
148
}
149
149
}
150
150
151
151
if (Test-Path $V1FilePath ) {
152
152
$BetaCommand = $Command.Replace (" -Mg" , " -MgBeta" )
153
153
$ConfirmBetaPath = Join-Path $WorkLoadDocsPath " graph-powershell-beta" " Microsoft.Graph.Beta.$Module " " $BetaCommand .md"
154
- if (Test-Path $ConfirmBetaPath ){
154
+ if (Test-Path $ConfirmBetaPath ) {
155
155
Add-Link - File $V1FilePath - Module $Module - GraphProfile " v1.0" - Command $Command
156
156
}
157
157
@@ -192,13 +192,14 @@ function Add-Link {
192
192
193
193
}
194
194
195
- $Block = $Matches [0 ]
196
195
$Link = " > [!NOTE]`n > $LinkTitle [$CommandRename ]($BaseUrl /$FullModuleName$View )`r`n`n ## SYNTAX"
197
196
$LinkOnEndOfDoc = " ## RELATED LINKS`r`n [$CommandRename ]($BaseUrl /$FullModuleName$View )"
198
- $NewBlock = $Block.Replace (" ## SYNTAX" , $Link )
197
+ $ConfirmCommandAvailability = Find-MgGraphCommand - Command $CommandRename
198
+ if ($ConfirmCommandAvailability ) {
199
199
(Get-Content $File ) |
200
- Foreach-Object { $_ -replace ' ## SYNTAX' , $Link -replace ' ## RELATED LINKS' , $LinkOnEndOfDoc } |
201
- Out-File $File
200
+ Foreach-Object { $_ -replace ' ## SYNTAX' , $Link -replace ' ## RELATED LINKS' , $LinkOnEndOfDoc } |
201
+ Out-File $File
202
+ }
202
203
}
203
204
}
204
205
catch {
0 commit comments