Skip to content

Commit 9558be0

Browse files
authored
Merge pull request #2875 from microsoftgraph/2867-find-mggraphcommand-returns-incorrect-api-reference-link-for-mguser-commands
Removes ``ApiReferenceLink`` values that point to intune API reference docs and adds AutoREST directive to remove ``Get-MgUserMailFolderMessageContent``
2 parents 804fd63 + e329857 commit 9558be0

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/Mail/Mail.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ require:
1717
1818
``` yaml
1919
# Directives go here!
20+
directive:
21+
# Remove cmdlets.
22+
- where:
23+
verb: Get
24+
subject: ^UserMailFolderMessageContent$
25+
remove: true
2026
```

tools/PostGeneration/NewCommandMetadata.ps1

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,29 @@ $ApiVersion | ForEach-Object {
8181
if(-not($CommandAliasValue.Contains("-Mg"))) {
8282
$CommandAliasValue = $null
8383
}
84+
$ExternalDocsUrl = ($RawFileContent -match $ExternalDocsPattern) ? $Matches.0 : $null
85+
if(-not($Null -eq $ExternalDocsUrl)) {
86+
$ExternalDocsUrl = $ExternalDocsUrl.Replace("intune-onboarding-", "")
87+
$ExternalDocsUrl = $ExternalDocsUrl.Replace("intune-mam-", "")
88+
89+
try {
90+
$HTTP_Request = [System.Net.WebRequest]::Create($ExternalDocsUrl)
91+
92+
# We then get a response from the site.
93+
$HTTP_Response = $HTTP_Request.GetResponse()
94+
95+
# We then get the HTTP code as an integer.
96+
$HTTP_Status = [int]$HTTP_Response.StatusCode
97+
98+
If (-not($HTTP_Status-eq 200)) {
99+
$ExternalDocsUrl = $Null
100+
}
101+
If ($HTTP_Response -ne $null) { $HTTP_Response.Close() }
102+
}
103+
catch {
104+
$ExternalDocsUrl = $Null
105+
}
106+
}
84107
$MappingValue = @{
85108
Command = $CommandName
86109
Variants = [System.Collections.ArrayList]@($VariantName)
@@ -89,7 +112,7 @@ $ApiVersion | ForEach-Object {
89112
ApiVersion = $CurrentApiVersion
90113
OutputType = ($RawFileContent -match $OutputTypePattern) ? $Matches.1 : $null
91114
Module = $ModuleName
92-
ApiReferenceLink = ($RawFileContent -match $ExternalDocsPattern) ? $Matches.0 : $null
115+
ApiReferenceLink = $ExternalDocsUrl
93116
CommandAlias = $CommandAliasValue
94117
Permissions = @()
95118
}

0 commit comments

Comments
 (0)