Skip to content

Commit 812dbc0

Browse files
committed
Added report to check the missing metadata ms prod values
1 parent 9494c03 commit 812dbc0

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

scripts/MsProdUpdate.ps1

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Param(
66
[string] $SDKDocsPath = ("..\msgraph-sdk-powershell\src"),
77
[string] $SDKOpenApiPath = ("..\msgraph-sdk-powershell"),
88
[string] $WorkLoadDocsPath = ("..\microsoftgraph-docs-powershell\microsoftgraph"),
9-
[string] $GraphDocsPath = ("..\microsoft-graph-docs")
9+
[string] $GraphDocsPath = ("..\microsoft-graph-docs"),
10+
[string] $MissingMsProdHeaderPath = ("..\microsoftgraph-docs-powershell\missingexternaldocsurl")
1011
)
1112
function Get-GraphMapping {
1213
$graphMapping = @{}
@@ -104,7 +105,7 @@ function Get-Files {
104105
}
105106
if ($UriPath) {
106107
$Method = $UriPaths.Method
107-
Get-ExternalDocs-Url -GraphProfile $GraphProfile -Url -UriPath $UriPath -Command $Command -OpenApiContent $OpenApiContent -File $File -Method $Method
108+
Get-ExternalDocs-Url -GraphProfile $GraphProfile -Url -UriPath $UriPath -Command $Command -OpenApiContent $OpenApiContent -File $File -Method $Method -Module $Module
108109
}
109110
}
110111
}
@@ -131,7 +132,8 @@ function Get-ExternalDocs-Url {
131132
[string] $Command = "Get-MgUser",
132133
[Hashtable] $OpenApiContent,
133134
[System.Object] $Method = "GET",
134-
[string] $File = "..\microsoftgraph-docs-powershell\microsoftgraph\graph-powershell-v1.0\Microsoft.Graph.Users\Get-MgUser.md"
135+
[string] $File = "..\microsoftgraph-docs-powershell\microsoftgraph\graph-powershell-v1.0\Microsoft.Graph.Users\Get-MgUser.md",
136+
[string] $Module = "Users"
135137
)
136138

137139
if ($UriPath) {
@@ -175,6 +177,25 @@ function Get-ExternalDocs-Url {
175177
if (-not([string]::IsNullOrEmpty($ExternalDocUrl))) {
176178
#$Url = $ExternalDocUrl.split(" ")
177179
WebScrapping -GraphProfile $GraphProfile -ExternalDocUrl $ExternalDocUrl -Command $Command -File $File
180+
}else{
181+
#Add report for missing external docs url
182+
#Version UriPath Command #Module
183+
$MissingMetaData = "$MissingMsProdHeaderPath\$Module\$Module.csv"
184+
#Create folder if it doesn't exist
185+
if (-not (Test-Path $Folder)) {
186+
"Graph profile, Command, UriPath" | Out-File -FilePath $MissingMetaData -Encoding ASCII
187+
}
188+
189+
#Check if module already exists
190+
$File = Get-Content $MissingMetaData
191+
$containsWord = $file | % { $_ -match "$GraphProfile, $Command, $UriPath" }
192+
if ($containsWord -contains $true) {
193+
#Skip adding to csv
194+
}
195+
else {
196+
"$GraphProfile, $Command, $UriPath" | Out-File -FilePath $MissingMetaData -Append -Encoding ASCII
197+
}
198+
178199
}
179200

180201
}

0 commit comments

Comments
 (0)