Skip to content

Removes ApiReferenceLink values that point to intune API reference docs and adds AutoREST directive to remove Get-MgUserMailFolderMessageContent #2875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Mail/Mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ require:

``` yaml
# Directives go here!
directive:
# Remove cmdlets.
- where:
verb: Get
subject: ^UserMailFolderMessageContent$
remove: true
```
25 changes: 24 additions & 1 deletion tools/PostGeneration/NewCommandMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,29 @@ $ApiVersion | ForEach-Object {
if(-not($CommandAliasValue.Contains("-Mg"))) {
$CommandAliasValue = $null
}
$ExternalDocsUrl = ($RawFileContent -match $ExternalDocsPattern) ? $Matches.0 : $null
if(-not($Null -eq $ExternalDocsUrl)) {
$ExternalDocsUrl = $ExternalDocsUrl.Replace("intune-onboarding-", "")
$ExternalDocsUrl = $ExternalDocsUrl.Replace("intune-mam-", "")

try {
$HTTP_Request = [System.Net.WebRequest]::Create($ExternalDocsUrl)

# We then get a response from the site.
$HTTP_Response = $HTTP_Request.GetResponse()

# We then get the HTTP code as an integer.
$HTTP_Status = [int]$HTTP_Response.StatusCode

If (-not($HTTP_Status-eq 200)) {
$ExternalDocsUrl = $Null
}
If ($HTTP_Response -ne $null) { $HTTP_Response.Close() }
}
catch {
$ExternalDocsUrl = $Null
}
}
$MappingValue = @{
Command = $CommandName
Variants = [System.Collections.ArrayList]@($VariantName)
Expand All @@ -89,7 +112,7 @@ $ApiVersion | ForEach-Object {
ApiVersion = $CurrentApiVersion
OutputType = ($RawFileContent -match $OutputTypePattern) ? $Matches.1 : $null
Module = $ModuleName
ApiReferenceLink = ($RawFileContent -match $ExternalDocsPattern) ? $Matches.0 : $null
ApiReferenceLink = $ExternalDocsUrl
CommandAlias = $CommandAliasValue
Permissions = @()
}
Expand Down