Skip to content

Commit e76b261

Browse files
committed
Added try catch on ms prod importation script
1 parent 635f834 commit e76b261

File tree

2 files changed

+56
-29
lines changed

2 files changed

+56
-29
lines changed

microsoftgraph/graph-powershell-beta/Microsoft.Graph.Beta.Teams/Update-MgBetaTeamworkTeamAppSetting.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,37 @@ Update-MgBetaTeamworkTeamAppSetting -BodyParameter <IMicrosoftGraphTeamsAppSetti
3232
Update the properties of a teamsAppSettings object.
3333

3434
## EXAMPLES
35-
### Example 1: Using the Update-MgBetaTeamworkTeamAppSetting Cmdlet
35+
### Example 1: Enable installation of apps that require resource-specific consent in chats/meetings.
36+
37+
```powershell
38+
39+
Import-Module Microsoft.Graph.Beta.Teams
40+
41+
$params = @{
42+
"@odata.type" = "#microsoft.graph.teamsAppSettings"
43+
isChatResourceSpecificConsentEnabled = "true"
44+
}
45+
46+
Update-MgBetaTeamworkTeamAppSetting -BodyParameter $params
47+
48+
```
49+
This example will enable installation of apps that require resource-specific consent in chats/meetings.
50+
51+
### Example 2: Allow Teams users to request admins for access to certain Teams Apps.
52+
3653
```powershell
54+
3755
Import-Module Microsoft.Graph.Beta.Teams
56+
3857
$params = @{
3958
"@odata.type" = "#microsoft.graph.teamsAppSettings"
40-
IsChatResourceSpecificConsentEnabled = "true"
59+
allowUserRequestsForAppAccess = "true"
4160
}
61+
4262
Update-MgBetaTeamworkTeamAppSetting -BodyParameter $params
63+
4364
```
44-
This example shows how to use the Update-MgBetaTeamworkTeamAppSetting Cmdlet.
45-
To learn about permissions for this resource, see the [permissions reference](/graph/permissions-reference).
65+
This example will allow teams users to request admins for access to certain teams apps.
4666

4767
## PARAMETERS
4868

scripts/MsProdUpdate.ps1

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -230,33 +230,40 @@ function WebScrapping {
230230

231231
$GraphDocsUrl = "https://raw.githubusercontent.com/microsoftgraph/microsoft-graph-docs-contrib/main/api-reference/$GraphProfile/api/$LastExternalDocUrlPathSegmentWithoutQueryParam.md"
232232
$MsprodContent = ""
233-
Write-Host "Downloading $GraphDocsUrl"
234-
($readStream, $HttpWebResponse) = FetchStream -GraphDocsUrl $GraphDocsUrl
233+
try{
234+
($readStream, $HttpWebResponse) = FetchStream -GraphDocsUrl $GraphDocsUrl
235235

236-
while (-not $readStream.EndOfStream) {
237-
$Line = $readStream.ReadLine()
238-
if ($Line -match "ms.prod") {
239-
$MsprodContent = $Line
240-
}
241-
}
242-
$HttpWebResponse.Close()
243-
$readStream.Close()
244-
245-
if ([string]::IsNullOrEmpty($MsprodContent)) {
246-
Write-Host "Ms Prod content is null or empty"
247-
}
248-
else {
249-
#Remove single and double qoutes from ms prod
250-
$MsprodContent = $MsprodContent.Replace("`"", "")
251-
$MsprodContent = $MsprodContent.Replace("'", "")
252-
$MetaDataText = "schema: 2.0.0`r`n$MsprodContent"
253-
(Get-Content $File) |
254-
Foreach-Object {
255-
if ($_ -notcontains $MetaDataText) {
256-
$_ -replace 'schema: 2.0.0', $MetaDataText
236+
while (-not $readStream.EndOfStream) {
237+
$Line = $readStream.ReadLine()
238+
if ($Line -match "ms.prod") {
239+
$MsprodContent = $Line
257240
}
258-
} |
259-
Out-File $File
241+
}
242+
$HttpWebResponse.Close()
243+
$readStream.Close()
244+
245+
if ([string]::IsNullOrEmpty($MsprodContent)) {
246+
Write-Host "Ms Prod content is null or empty"
247+
}
248+
else {
249+
#Remove single and double qoutes from ms prod
250+
$MsprodContent = $MsprodContent.Replace("`"", "")
251+
$MsprodContent = $MsprodContent.Replace("'", "")
252+
$MetaDataText = "schema: 2.0.0`r`n$MsprodContent"
253+
(Get-Content $File) |
254+
Foreach-Object {
255+
if ($_ -notcontains $MetaDataText) {
256+
$_ -replace 'schema: 2.0.0', $MetaDataText
257+
}
258+
} |
259+
Out-File $File
260+
}
261+
}catch {
262+
Write-Host "`nError Message: " $_.Exception.Message
263+
Write-Host "`nError in Line: " $_.InvocationInfo.Line
264+
Write-Host "`nError in Line Number: "$_.InvocationInfo.ScriptLineNumber
265+
Write-Host "`nError Item Name: "$_.Exception.ItemName
266+
Write-Host "`nRaw docs url : " $GraphDocsUrl
260267
}
261268
}
262269

0 commit comments

Comments
 (0)