[Index]
MSTeamsOnline_powershell_envelope
Model ref.: data/MSTeamsOnline_powershell_envelope
The full URL would include the host-proxy name: https://[host-proxy].
Variables are enclosed in square brackets.
{
"$schema": "http://json-schema.org/draft-03/schema",
"type": "object",
"properties": {
"name": {
"required": true,
"type": "string",
"title": "Name"
},
"envelope": {
"required": true,
"type": "string",
"title": "Envelope"
}
},
"schema_version": "1.0.0"
}
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Get the GUI Add form. | GET | /api/data/MSTeamsOnline_powershell_envelope/add/ |
|
The GUI Add form of data/MSTeamsOnline_powershell_envelope as JSON |
The API call to the /add/ URL can only be made from a hierarchy that allows the model type to be added. The actions in the response shows the url for the POST API call to create an instance.
| Task | Call | URL | Parameters | Payload |
|---|---|---|---|---|
| Create | POST | /api/data/MSTeamsOnline_powershell_envelope | hierarchy=[hierarchy] |
|
tool/Transaction/[trans pkid]to inspect the created resource and its instance pkid.
| Task | Call | URL | Parameters | Payload |
|---|---|---|---|---|
| Bulk delete [pkid1],[pkid2]... | DELETE | /api/data/MSTeamsOnline_powershell_envelope/ | hierarchy=[hierarchy] | {"hrefs":["/api/data/MSTeamsOnline_powershell_envelope/[pkid1]", "/api/data/MSTeamsOnline_powershell_envelope/[pkid2]", ...]} |
GET http://[host-proxy]/api/data/MSTeamsOnline_powershell_envelope/?hierarchy=[hierarchy]&format=json
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Bulk Modify | GET | /api/data/MSTeamsOnline_powershell_envelope/bulk_update/?schema=&schema_rules=true |
|
|
| Task | Call | URL | Parameters | Payload |
|---|---|---|---|---|
| Bulk Modify | POST | /api/data/MSTeamsOnline_powershell_envelope/bulk_update/ |
|
For example: {"data":{"name":"value"}, "meta":{}, "request_meta":{ "hrefs":["/api/v0/data/MSTeamsOnline_powershell_envelope/[pkid1]", "/api/v0/data/MSTeamsOnline_powershell_envelope/[pkid2]",...]}} |
GET http://[host-proxy]/api/data/MSTeamsOnline_powershell_envelope/?hierarchy=[hierarchy]&format=json
| Task | Call | URL | Parameters | Payload |
|---|---|---|---|---|
| Get a selected [export_format] of the schema and instances [pkid1], [pkid2],... of data/MSTeamsOnline_powershell_envelope; optionally with tag_version at [version] and Configuration Template as [configtemplate]. | POST | /api/data/MSTeamsOnline_powershell_envelope/export/ |
|
{ "hrefs":["/api/data/MSTeamsOnline_powershell_envelope/[pkid1]", "/api/data/MSTeamsOnline_powershell_envelope/[pkid2]",...]}} |
For export_format=json, the response is a time stamped zip file of data in JSON as in the system database. Item properties such as strings that are empty or Boolean values that are not set, are not included. The filename in the response is of the format as the example:
Content-Disposition: attachment; filename=export_2013-05-17_14:20:19.186444.json.zip
Content-Language:en
Content-Type:application/x-zip
For export_format=raw_xlsx, the response is a MS Excel spreadsheet with columns corresponding to the JSON format export and a response filename format:
Content-Disposition: attachment; filename=<resource_type>_<resource_name>_exportedsheet_CCYY-MM-DD_HH-MM-SS.xlsx
Content-Language:en
Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
For export_format=xlsx, the response is a MS Excel spreadsheet, arranged by any Field Display Policies that apply. The columns correspond with those of a Bulk Load Template export sheet. The response filename format is:
Content-Disposition: attachment; filename=<resource_type>_<resource_name>_exportedsheet_formatted_CCYY-MM-DD_HH-MM-SS.xlsx
Content-Language:en
Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
The XLSX format can be used to bulk load instances of data/MSTeamsOnline_powershell_envelope and the JSON format can be used to import instances of data/MSTeamsOnline_powershell_envelope.
GET http://[host-proxy]/api/data/MSTeamsOnline_powershell_envelope/?hierarchy=[hierarchy]
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Get a compressed format of the Bulk Load spreadsheet template for data/MSTeamsOnline_powershell_envelope | POST | /api/data/MSTeamsOnline_powershell_envelope/export_bulkload_template/ |
|
The response is an attachment of the format: filetype_bulkloadsheet.xlsx.gz |
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Tag | PATCH | /api/data/MSTeamsOnline_powershell_envelope/+tag/ |
|
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Tag Version | PATCH | /api/data/MSTeamsOnline_powershell_envelope/+tag_version/ |
|
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Configuration Template | GET | /api/data/MSTeamsOnline_powershell_envelope/configuration_template/ | hierarchy=[hierarchy] |
|
POST http://[host-proxy]/api/data/ConfigurationTemplate/?hierarchy=[hierarchy]
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Field Display Policy | GET | /api/data/MSTeamsOnline_powershell_envelope/field_display_policy/ | hierarchy=[hierarchy] |
|
POST http://[host-proxy]/api/data/FieldDisplayPolicy/?hierarchy=[hierarchy]
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Migration Template | GET | /api/data/MSTeamsOnline_powershell_envelope/migration/ |
|
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| List | GET | /api/data/MSTeamsOnline_powershell_envelope/ |
|
The data/MSTeamsOnline_powershell_envelope schema and all instances as JSON. |
(The list will return 0 to 3 data/MSTeamsOnline_powershell_envelope instances)
{
"pagination": {
"skip": 0,
"limit": 3,
"maximum_limit": 2000,
"total": 3,
"total_limit": null,
"order_by": "name",
"direction": "asc",
"current": "/api/data/MSTeamsOnline_powershell_envelope/?skip=0&limit=3&order_by=name&direction=asc&traversal=down"
},
"operations": [
"field_display_policy",
"add",
"migration",
"export",
"get",
"configuration_template",
"list",
"export_bulkload_template",
"remove",
"move",
"transform",
"bulk_update_form",
"update",
"help"
],
"meta": {
"model_type": "data/MSTeamsOnline_powershell_envelope",
"summary_attrs": [
{
"name": "name",
"title": "Name"
},
{
"name": "hierarchy_friendly_name",
"title": "Located At",
"allow_filtering": true
}
],
"tagged_versions": [],
"tags": [],
"title": "",
"business_key": {
"hierarchy": true,
"unique": [
"name"
]
},
"api_version": "21.2",
"cached": true,
"references": {
"children": [],
"parent": [
{
"href": "/api/data/HierarchyNode/6t0ggef2c0deab00hb595101",
"pkid": "6t0ggef2c0deab00hb595101"
}
],
"device": [
{
"href": "",
"pkid": ""
}
],
"foreign_key": []
},
"model_specific_actions": [
"add",
"bulk_update_form",
"clone",
"configuration_template",
"export",
"export_bulkload_template",
"field_display_policy",
"get",
"help",
"list",
"migration",
"transform",
"remove",
"tag",
"tag_version",
"update"
],
"schema_version": "1.0.0",
"actions": [
{
"add": {
"method": "GET",
"class": "add",
"href": "/api/data/MSTeamsOnline_powershell_envelope/add/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Add"
}
},
{
"remove": {
"method": "DELETE",
"class": "delete",
"href": "/api/data/MSTeamsOnline_powershell_envelope/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Delete"
}
},
{
"bulk_update_form": {
"method": "GET",
"class": "update",
"href": "/api/data/MSTeamsOnline_powershell_envelope/bulk_update/?hierarchy=[hierarchy]&schema=&schema_rules=true",
"support_async": false,
"title": "Bulk Modify"
}
},
{
"export": {
"method": "POST",
"class": "export",
"href": "/api/data/MSTeamsOnline_powershell_envelope/export/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Export",
"view": "/api/view/ExportData/add/?auth_token=[authtoken],
"submit": "payload"
}
},
{
"export_bulkload_template": {
"method": "POST",
"class": "bulkload_template",
"href": "/api/data/MSTeamsOnline_powershell_envelope/export_bulkload_template/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Export Bulk Load Template"
}
},
{
"tag": {
"method": "PATCH",
"class": "tag",
"href": "/api/data/MSTeamsOnline_powershell_envelope/+tag/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Tag",
"view": "/api/view/TagNameForm/add/?auth_token=[authtoken]
}
},
{
"tag_version": {
"method": "PATCH",
"class": "tag_version",
"href": "/api/data/MSTeamsOnline_powershell_envelope/+tag_version/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Tag Version",
"view": "/api/view/TagVersionForm/add/?auth_token=[authtoken]
}
},
{
"configuration_template": {
"method": "GET",
"class": "config",
"href": "/api/data/MSTeamsOnline_powershell_envelope/configuration_template/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Configuration Template"
}
},
{
"field_display_policy": {
"method": "GET",
"class": "display_policy",
"href": "/api/data/MSTeamsOnline_powershell_envelope/field_display_policy/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Field Display Policy"
}
},
{
"migration": {
"method": "GET",
"class": "migration",
"href": "/api/data/MSTeamsOnline_powershell_envelope/migration/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Migration Template"
}
},
{
"list": {
"method": "GET",
"class": "list",
"href": "/api/data/MSTeamsOnline_powershell_envelope/?hierarchy=[hierarchy]",
"support_async": false,
"title": "List"
}
},
{
"help": {
"method": "GET",
"class": "help",
"href": "/api/data/MSTeamsOnline_powershell_envelope/help?hierarchy=[hierarchy]",
"support_async": false,
"title": "Help"
}
},
{
"transform": {
"method": "GET",
"class": "transform",
"href": "/api/data/MSTeamsOnline_powershell_envelope/transform/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Transform Template"
}
}
]
},
"resources": [
{
"data": {
"name": "bulk",
"envelope": "$internal_testing_activated = if ('{{ driver_parameters.internal_testing_activated }}' -eq 'true') { $true } else { $false }\nif ($internal_testing_activated) {\n # This feature is NOT designed for continuous use but should be turned on for a specific test and then turned off again.\n # This will include the full transcript only once the \"remote\" session returns. \n # Use the remote transcript for real time monitoring by running the commented out command below.\n # Get-Content -Path \"C:\\VOSS\\<filename>_realtime_transcript.txt\" -Wait\n $null = Start-Transcript -Path \"C:\\VOSS\\{{ execution_id }}_transcript.txt\"\n}\n$internal_testing_third_party_debug_activated = if ('{{ driver_parameters.internal_testing_third_party_debug_activated }}' -eq 'true') { $true } else { $false }\nif ($internal_testing_activated -and $internal_testing_third_party_debug_activated) {\n # This allows debug messages from third party modules to be included in the output.\n $DebugPreference = \"Continue\"\n} else {\n $DebugPreference = \"SilentlyContinue\"\n}\n\n$errorStrings = @(\n \"Invalid credential\",\n \"Unauthorized\"\n)\n\nfunction Connect {\n $uc_output = @{success=$TRUE}\n $hostname = '{{ driver_parameters.get('host', '').replace(\"'\", \"''\") }}'\n $domain_name = @{$true=$hostname; $false='.'}[[bool]'{{ driver_parameters.get('domain_name', '').replace(\"'\", \"''\") }}']\n $inet_proxy_username = '{{ driver_parameters.get('proxy_username', '').replace(\"'\", \"''\") }}'\n $inet_proxy_password = '{{ driver_parameters.get('proxy_password', '').replace(\"'\", \"''\") }}'\n $online_username = '{{ driver_parameters.get('online_username', '').replace(\"'\", \"''\") }}'\n $online_password = '{{ driver_parameters.get('online_password', '').replace(\"'\", \"''\") }}'\n $tenant_id = '{{ driver_parameters.get('tenant_id', '').replace(\"'\", \"''\") }}'\n $client_id = '{{ driver_parameters.get('client_id', '').replace(\"'\", \"''\") }}'\n $client_secret = '{{ driver_parameters.get('client_secret', '').replace(\"'\", \"''\") }}'\n $certificate_thumbprint = '{{ driver_parameters.get('certificate_thumbprint', '').replace(\"'\", \"''\") }}'\n $basic_auth_models = '{{ driver_parameters.get('basic_auth_models', '').replace(\"'\", \"''\") }}'.split(',')\n $model_type = '{{ model_type }}'\n $cloud_environment = '{{ driver_parameters.get('cloud_environment', '').replace(\"'\", \"''\") }}'\n\n {%- if driver_parameters.get('use_proxy', 'false').lower() in ('true', 't') %}\n $registryPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\"\n $proxySettings = (Get-ItemProperty -Path \"$registryPath\\Connections\" -Name DefaultConnectionSettings).DefaultConnectionSettings\n $proxyLen = $proxySettings[12]\n $proxyStart = 16\n $proxyEnd = $proxyStart + $proxyLen - 1\n $proxyString = [System.Text.Encoding]::ASCII.GetString($proxySettings[$proxyStart..$proxyEnd])\n [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy($proxyString)\n\n {%- if driver_parameters.get('use_proxy_auth', 'false').lower() in ('true', 't') %}\n $inet_proxy_securestring = New-Object -TypeName:System.Security.SecureString\n $inet_proxy_password.ToCharArray() | ForEach-Object { $inet_proxy_securestring.AppendChar($_) }\n $inet_proxy_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($inet_proxy_username, $inet_proxy_securestring)\n [System.Net.WebRequest]::DefaultWebProxy.Credentials = $inet_proxy_credentials\n $sessionOptions = New-PSSessionOption -ProxyAccessType IEConfig -ProxyAuthentication Basic -ProxyCredential $inet_proxy_credentials\n {%- else %}\n $sessionOptions = New-PSSessionOption -ProxyAccessType IEConfig\n {%- endif %}\n {%- else %}\n $sessionOptions = New-PSSessionOption\n {%- endif %}\n $online_credentials = $null\n if ($online_password) {\n $online_securestring = ConvertTo-SecureString $online_password -AsPlainText -Force\n $online_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($online_username,$online_securestring)\n }\n $app_auth_allowed = $true\n if ($model_type -in $basic_auth_models) {\n $app_auth_allowed = $false\n }\n\n [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n try {\n $Params = @{}\n if ($cloud_environment) {\n $Params.TeamsEnvironmentName = $cloud_environment\n }\n if ($certificate_thumbprint -and $tenant_id -and $client_id -and $app_auth_allowed) {\n $Params.CertificateThumbprint = $certificate_thumbprint\n $Params.ApplicationId = $client_id\n $Params.TenantId = $tenant_id\n }\n elseif ($client_secret -and $tenant_id -and $client_id -and $app_auth_allowed) {\n $graphtokenBody = @{\n Grant_Type = \"client_credentials\"\n Scope = \"{{ driver_parameters.api_base }}.default\"\n Client_Id = $client_id\n Client_Secret = $client_secret\n }\n $graphToken = Invoke-RestMethod -Uri \"{{ driver_parameters.login_api_base }}$tenant_id/oauth2/v2.0/token\" -Method POST -Body $graphtokenBody | Select-Object -ExpandProperty Access_Token\n $teamstokenBody = @{\n Grant_Type = \"client_credentials\"\n Scope = \"48ac35b8-9aa8-4d74-927d-1f4a14a0b239/.default\"\n Client_Id = $client_id\n Client_Secret = $client_secret\n }\n $teamsToken = Invoke-RestMethod -Uri \"{{ driver_parameters.login_api_base }}$tenant_id/oauth2/v2.0/token\" -Method POST -Body $teamstokenBody | Select-Object -ExpandProperty Access_Token\n $Params.AccessTokens = @(\"$graphToken\", \"$teamsToken\")\n }\n elseif ($online_credentials) {\n $Params.Credential = $online_credentials\n }\n else {\n throw \"No valid authentication provided\"\n }\n if ($internal_testing_activated) {\n Write-Host \"Params: $($Params | Format-List | Out-String)\"\n }\n Connect-MicrosoftTeams @Params | out-null\n return @{success=$TRUE}\n }\n catch {\n $err_msg = 'Connection error: ' + $_.Exception.Message\n return @{success=$FALSE; result=$err_msg}\n }\n}\n\n# Bulk error handling logic to reconnect if session to Microsoft cloud drops (which it absolutely will)\nfunction Run-TeamsCmdletWithRetry {\n param (\n [ScriptBlock]$Cmdlet\n )\n\n $retryCount = 0\n $maxRetries = 1\n while ($retryCount -le $maxRetries) {\n try {\n $result = & $Cmdlet\n return $result # Exit if successful\n } catch {\n $errorMessage = $_.Exception.Message\n\n # Check if the error message matches any of the predefined error strings\n $shouldReconnect = $false\n foreach ($errorString in $errorStrings) {\n if ($errorMessage -match [regex]::Escape($errorString)) {\n $shouldReconnect = $true\n break\n }\n }\n\n if ($shouldReconnect -and $retryCount -lt $maxRetries) {\n Write-Host \"Attempting reconnection...\"\n $reconnect_uc_output = Connect\n if ($reconnect_uc_output.success -ne $true) {\n throw \"Reconnection failed: $($reconnect_uc_output.result)\"\n }\n $retryCount++\n } else {\n $customError = @{\n ErrorMessage = $errorMessage\n RetryCount = $retryCount\n }\n throw ([pscustomobject]$customError)\n }\n }\n }\n}\n\n$uc_output = @{success=$FALSE}\n$uc_output = Connect\n\ntry {\n if ($uc_output.success -eq $TRUE) {\n $input = @'\n{{ input|to_json }}\n'@ | ConvertFrom-Json\n\n # Read the input data\n # The input file is expected to be a zip file in the %TEMP% folder containing a JSON file\n $inputData = @()\n try {\n $TempPath = [System.IO.Path]::GetTempPath()\n #$TempPath = Split-Path $TempPath # Use when debugging via RDP\n $InputFilePath = Join-Path -Path $TempPath -ChildPath $input.InputFileName\n $OutputFolderPath = Join-Path -Path $TempPath -ChildPath \"{{ execution_id }}\"\n\n # Check if the input file exists\n if (-Not (Test-Path -Path $InputFilePath)) {\n throw \"File $InputFilePath does not exist.\"\n }\n\n # Overwrite any previously extracted files\n try {\n Expand-Archive -LiteralPath $InputFilePath -DestinationPath $OutputFolderPath -Force\n } catch {\n throw \"Error extracting compressed file ${InputFilePath}: $($_.Exception.Message)\"\n }\n $extractedFiles = Get-ChildItem -Path $OutputFolderPath\n if ($extractedFiles.Count -gt 1) {\n throw \"Multiple files found in compressed file $InputFilePath\"\n }\n $ExtractedFilePath = $extractedFiles[0].FullName \n # It used to work like the line below but seems to be different depending on the execution context (remote vs local script)\n #Join-Path -Path $OutputFolderPath -ChildPath $extractedFiles[0]\n\n # Read the extracted file into a variable\n try {\n $jsonData = Get-Content -Path $ExtractedFilePath | ConvertFrom-Json\n $inputData = $jsonData.InputRecords\n } catch {\n throw \"Error getting data from file ${ExtractedFilePath}: $($_.Exception.Message)\"\n }\n }\n catch {\n $err_msg = 'Error getting input data: ' + $_.Exception.Message\n $uc_output=@{success=$FALSE; result=$err_msg}\n }\n }\n\n # Perform bulk operations using $InputData\n if ($uc_output.success -eq $TRUE) {\n {%- block command %}{%- endblock %}\n }\n\n if ($uc_output -ne $NULL) {\n $uc_output.type='result'\n }\n # Convert the result to JSON if it is a hashtable or an array so as to avoid having Automate load and dump it again.\n if (($uc_output.result -is [hashtable]) -or ($uc_output.result -is [array])) {\n # If the result is an empty array, manually set the result to the JSON representation of an empty array.\n # This is done because ConvertTo-Json will turn an empty array into a null value which makes no sense but there you are. \n if(($uc_output.result -is [array]) -and ($uc_output.result.Count -eq 0)) {\n $uc_output.result = '[]'\n }\n else {\n $uc_output.result = $uc_output.result | ConvertTo-Json -Compress:$true -Depth:25\n }\n }\n\n Write-Output (ConvertTo-Json -Compress:$true -Depth:25 $uc_output)\n} finally {\n Disconnect-MicrosoftTeams | out-null\n}\n\nif ($internal_testing_activated) {\n $null = Stop-Transcript\n}",
"pkid": "6893873241f63fe774b72258",
"hierarchy_friendly_name": "sys (System)",
"hierarchy_path": "sys"
},
"meta": {
"model_type": "data/MSTeamsOnline_powershell_envelope",
"summary_attrs": [
{
"name": "name",
"title": "Name"
},
{
"name": "hierarchy_friendly_name",
"title": "Located At",
"allow_filtering": true
}
],
"tagged_versions": [],
"tags": [
"msteamsonline",
"V4UC",
"ba_CommonOverlay"
],
"title": "bulk",
"business_key": {
"hierarchy": true,
"unique": [
"name"
]
},
"api_version": "21.2",
"cached": true,
"references": {
"parent": [
{
"pkid": "6t0ggef2c0deab00hb595101",
"href": "/api/data/HierarchyNode/6t0ggef2c0deab00hb595101"
}
],
"device": [
{
"href": "",
"pkid": ""
}
],
"foreign_key": [],
"owner": [
{
"pkid": ""
}
],
"self": [
{
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/",
"pkid": "6893873241f63fe774b72257"
}
]
},
"path": [
"6t0ggef2c0deab00hb595101",
"6893873241f63fe774b72257"
],
"schema_version": "1.0.0",
"actions": [
{
"update": {
"method": "PUT",
"class": "update",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/",
"support_async": true,
"title": "Modify"
}
},
{
"remove": {
"method": "DELETE",
"class": "delete",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/",
"support_async": true,
"title": "Delete"
}
},
{
"clone": {
"method": "GET",
"class": "clone",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/clone/?schema=&schema_rules=true",
"support_async": false,
"title": "Clone"
}
},
{
"export": {
"method": "GET",
"class": "export",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/export/",
"support_async": false,
"title": "Export",
"view": "/api/view/ExportData/add/",
"submit": "payload"
}
},
{
"tag": {
"method": "PATCH",
"class": "tag",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/+tag/",
"support_async": true,
"title": "Tag",
"view": "/api/view/TagNameForm/add/"
}
},
{
"tag_version": {
"method": "PATCH",
"class": "tag_version",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/+tag_version/",
"support_async": true,
"title": "Tag Version",
"view": "/api/view/TagVersionForm/add/"
}
},
{
"get": {
"method": "GET",
"class": "get",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/",
"support_async": false,
"title": "Get"
}
},
{
"help": {
"method": "GET",
"class": "help",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/help",
"support_async": false,
"title": "Help"
}
}
],
"summary": "false"
},
"pkid": "6893873241f63fe774b72257"
},
{
"data": {
"name": "cloud",
"envelope": "$OutputEncoding = New-Object -TypeName:System.Text.UTF8Encoding\n[Console]::OutputEncoding = [text.encoding]::UTF8\n\n$command = {\n{%- block command %}{%- endblock %}\n if ($uc_output -ne $NULL) {$uc_output.type='result'}; return $uc_output\n}\n\n$maxRetrySeconds = 65\n$startTime = [DateTime]::now\ndo {\n $retryRequired = $false\n\n # Establish connection to Microsoft cloud\n\t$null = Invoke-Command -ScriptBlock $functionDefinitions -ErrorAction Stop\n\t$online_username = '{{ driver_parameters.get('online_username', '').replace(\"'\", \"''\") }}'\n\t$online_password = '{{ driver_parameters.get('online_password', '').replace(\"'\", \"''\") }}'\n\t$online_securestring = ConvertTo-SecureString $online_password -AsPlainText -Force\n\t$online_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($online_username,$online_securestring)\n\t[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n\t$uc_output = @{}\n\t$uc_output.type = 'result'\n\ttry {\n\t\t$null = Connect-MicrosoftTeams -Credential $online_credentials -ErrorAction Stop\n\t\t$uc_output.success = $true\n\t}\n\tcatch {\n\t\t$null = Invoke-Command -NoNewScope -ScriptBlock $functionDefinitions -ErrorAction Stop\n\t\t$defaultErrorText = ''\n\t\t$uc_output = Get-GenericPowerShellErrorHandling -ExceptionList $Ex -DefaultErrorText $defaultErrorText -ErrorRecord $Error[0]\n\t\tif ($uc_output.result -eq '') {\n\t\t\t$uc_output.result = \"Failed to establish Online Session: <<<$_>>>\"\n\t\t}\n\t\telse {\n\t\t\t$uc_output.result = 'Failed to establish Online Session:' + $uc_output.result\n\t\t}\n\t\t$uc_output.retryable = $false\n\t}\n\n\n # Run command\n if ($uc_output.success -eq $true) {\n try {\n $null = Invoke-Command -NoNewScope -ScriptBlock $functionDefinitions -ErrorAction Stop\n $uc_output = Invoke-Command -ScriptBlock $command -ErrorAction Stop\n }\n catch {\n $null = Invoke-Command -NoNewScope -ScriptBlock $functionDefinitions -ErrorAction Stop\n $defaultErrorText = ''\n $uc_output = Get-GenericPowerShellErrorHandling -ExceptionList $Ex -DefaultErrorText $defaultErrorText -ErrorRecord $Error[0]\n $uc_output.type = 'result'\n if ($uc_output.result -eq '') {\n $uc_output.result = \"Caught exception executing command: <<<$_>>>\"\n }\n else {\n $uc_output.result = 'Caught exception executing command:' + $uc_output.result\n }\n }\n $uc_output.type = 'result'\n }\n\n # Handle retrying\n if ($uc_output.success -eq $false) {\n $duration = ([DateTime]::now - $startTime).TotalSeconds\n if ($uc_output.retryable -eq $true) {\n if (($sleepSeconds = $uc_output.delay) -gt 0) {\n Write-Output \"Sleeping $sleepSeconds\"\n Start-Sleep -Seconds $sleepSeconds\n $retryRequired = ($duration -lt $maxRetrySeconds)\n }\n else {\n $retryRequired = $true\n }\n }\n else {\n $retryRequired = $false\n }\n if ($retryRequired) {\n Write-Output 'Retrying...'\n Clear-Variable uc_output\n }\n else {\n Write-Output ('Attempt failed after {0:0} seconds with error:' -f $duration)\n Write-Output $uc_output.result\n }\n }\n else {\n $retryRequired = $false\n }\n} while ($retryRequired)\nDisconnect-MicrosoftTeams\nWrite-Output (ConvertTo-Json -Compress:$true -Depth:25 $uc_output)",
"pkid": "63c66e77822627eb049a2edb",
"hierarchy_friendly_name": "sys (System)",
"hierarchy_path": "sys"
},
"meta": {
"model_type": "data/MSTeamsOnline_powershell_envelope",
"summary_attrs": [
{
"name": "name",
"title": "Name"
},
{
"name": "hierarchy_friendly_name",
"title": "Located At",
"allow_filtering": true
}
],
"tagged_versions": [],
"tags": [
"msteamsonline",
"V4UC",
"ba_CommonOverlay"
],
"title": "cloud",
"business_key": {
"hierarchy": true,
"unique": [
"name"
]
},
"api_version": "21.2",
"cached": true,
"references": {
"device": [
{
"href": "",
"pkid": ""
}
],
"owner": [
{
"pkid": ""
}
],
"parent": [
{
"pkid": "6t0ggef2c0deab00hb595101",
"href": "/api/data/HierarchyNode/6t0ggef2c0deab00hb595101"
}
],
"foreign_key": [],
"self": [
{
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/",
"pkid": "63c66e77822627eb049a2eda"
}
]
},
"path": [
"6t0ggef2c0deab00hb595101",
"63c66e77822627eb049a2eda"
],
"schema_version": "1.0.0",
"actions": [
{
"update": {
"method": "PUT",
"class": "update",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/",
"support_async": true,
"title": "Modify"
}
},
{
"remove": {
"method": "DELETE",
"class": "delete",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/",
"support_async": true,
"title": "Delete"
}
},
{
"clone": {
"method": "GET",
"class": "clone",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/clone/?schema=&schema_rules=true",
"support_async": false,
"title": "Clone"
}
},
{
"export": {
"method": "GET",
"class": "export",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/export/",
"support_async": false,
"title": "Export",
"view": "/api/view/ExportData/add/",
"submit": "payload"
}
},
{
"tag": {
"method": "PATCH",
"class": "tag",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/+tag/",
"support_async": true,
"title": "Tag",
"view": "/api/view/TagNameForm/add/"
}
},
{
"tag_version": {
"method": "PATCH",
"class": "tag_version",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/+tag_version/",
"support_async": true,
"title": "Tag Version",
"view": "/api/view/TagVersionForm/add/"
}
},
{
"get": {
"method": "GET",
"class": "get",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/",
"support_async": false,
"title": "Get"
}
},
{
"help": {
"method": "GET",
"class": "help",
"href": "/api/data/MSTeamsOnline_powershell_envelope/63c66e77822627eb049a2eda/help",
"support_async": false,
"title": "Help"
}
}
],
"summary": "false"
},
"pkid": "63c66e77822627eb049a2eda"
},
{
"data": {
"name": "default",
"envelope": "$internal_testing_activated = if ('{{ driver_parameters.internal_testing_activated }}' -eq 'true') { $true } else { $false }\nif ($internal_testing_activated) {\n # This feature is NOT designed for continuous use but should be turned on for a specific test and then turned off again.\n # Monitor the file using the command below to avoid breaking the running script with file lock errors.\n # Get-Content -Path \"C:\\VOSS\\<execution_id>_transcript.txt\" -Wait\n $execution_id = \"{{ execution_id }}\" # This value is templated in Automate\n # This is to support the internal debugging feature on releases prior to 25.1 where test connection has no execution_id during template rendering (EKB-24617)\n if (!$execution_id) { \n $scriptPath = $MyInvocation.MyCommand.Path\n $scriptName = Split-Path -Path $scriptPath -Leaf\n $execution_id = $scriptName -split \"_\" | Select-Object -Index 1\n }\n $transcription_file_name = \"C:\\VOSS\\\" + $execution_id + \"_transcript.txt\"\n try {\n $null = Start-Transcript -Path $transcription_file_name -ErrorAction Stop\n } catch {\n Write-Host \"Transcription for file \" + $transcription_file_name + \" could not be started: $_\"\n throw\n }\n}\n$internal_testing_third_party_debug_activated = if ('{{ driver_parameters.internal_testing_third_party_debug_activated }}' -eq 'true') { $true } else { $false }\nif ($internal_testing_activated -and $internal_testing_third_party_debug_activated) {\n # This allows debug messages from third party modules to be included in the output.\n $DebugPreference = \"Continue\"\n} else {\n $DebugPreference = \"SilentlyContinue\"\n}\n$OutputEncoding = New-Object -TypeName:System.Text.UTF8Encoding\n[Console]::OutputEncoding = [text.encoding]::UTF8\n$PSStyle.OutputRendering = 'PlainText'\n$envelope_version = 'MSTeams_v2'\n$hostname = '{{ driver_parameters.get('host', '').replace(\"'\", \"''\") }}'\n$domain_name = @{$true=$hostname; $false='.'}[[bool]'{{ driver_parameters.get('domain_name', '').replace(\"'\", \"''\") }}']\n$local_username = '{{ driver_parameters.get('username', '').replace(\"'\", \"''\") }}'\n$local_password = '{{ driver_parameters.get('password', '').replace(\"'\", \"''\") }}'\n$session_name = '{{ driver_parameters.get('concurrency_uniqueness', '').replace(\"'\", \"''\") }}' + '_' + $envelope_version\n$basic_auth_models = '{{ driver_parameters.get('basic_auth_models', 'None').replace(\"'\", \"''\") }}'.split(',')\n$model_type = '{{ model_type }}'\nif ($model_type -in $basic_auth_models) {\n $session_name = $session_name + '_' + 'basic_auth'\n}\n# Always use a unique session name for bulk provisioning to maximize batch size\nif ($model_type -like \"*BulkProvision\") {\n $random_guid = [guid]::NewGuid().ToString()\n $session_name = \"$session_name_bulk_$random_guid\"\n}\n$local_securestring = ConvertTo-SecureString $local_password -AsPlainText -Force\n$local_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($local_username,$local_securestring)\n\nif ($internal_testing_activated) {\n try {\n $null = Stop-Transcript -ErrorAction Stop\n } catch {\n Write-Host \"Unable to stop transcription: $_\"\n }\n}\n\n# This command causes transcription to stop which is why it is wrapped with a stop and a start\n$sessions = Get-PsSession -Authentication Basic -Credential $local_credentials -ComputerName $domain_name -State Disconnected -Name $session_name | Where-Object {$_.Availability.ToString() -eq \"None\"}\n\nif ($internal_testing_activated) {\n try {\n $null = Start-Transcript -Append -Path $transcription_file_name -ErrorAction Stop\n } catch {\n Write-Host \"Transcription for file \" + $transcription_file_name + \" could not be started: $_\"\n throw\n }\n}\n\n$cnt = 0;\n$sessionToUse=$null\n# Always use a new session if this debug feature is on. \n# This is to ensure that testing of session timeouts always starts from the same point.\n$internal_testing_force_new_session = $false\nif ($internal_testing_activated) {\n $internal_testing_force_new_session = if ('{{ driver_parameters.internal_testing_force_new_session }}' -eq 'true') { $true } else { $false }\n}\nif ($internal_testing_force_new_session -eq $false) {\n foreach ($session in $sessions) {\n try {\n write-output (\"At {0} attempting to connect to session\" -f [DateTime]::now)\n $session | Format-List | Write-Output\n $sessionToUse = Connect-PSSession -Session $session -ErrorAction Stop\n write-output (\"At {0} successfully connected to session\" -f [DateTime]::now)\n $sessionToUse | Format-List | Write-Output\n if ($sessionToUse.Availability -eq 'Busy' -and $sessionToUse.State -eq 'Opened') {\n write-output (\"At {0} the session was busy after connection, trying other sessions\" -f [DateTime]::now)\n $sessionToUse = $null\n continue\n }\n break\n }\n catch {\n Write-Output (\"At {0} session is no longer useable\" -f [DateTime]::now)\n $session | Format-List | Write-Output\n $sessionToUse = $null\n }\n }\n}\n\n$command = {\n param($transcription_file_name)\n Write-Host \"PowerShell Version in Session: $($PSVersionTable.PSVersion)\"\n $internal_testing_activated = if ('{{ driver_parameters.internal_testing_activated }}' -eq 'true') { $true } else { $false }\n if ($internal_testing_activated) {\n try {\n $null = Start-Transcript -Append -Path $transcription_file_name -ErrorAction Stop\n } catch {\n Write-Host \"Transcription for file \" + $transcription_file_name + \" could not be started: $_\"\n throw\n }\n }\n $internal_testing_third_party_debug_activated = if ('{{ driver_parameters.internal_testing_third_party_debug_activated }}' -eq 'true') { $true } else { $false }\n if ($internal_testing_activated -and $internal_testing_third_party_debug_activated) {\n # This allows debug messages from third party modules to be included in the output.\n $DebugPreference = \"Continue\"\n } else {\n $DebugPreference = \"SilentlyContinue\"\n }\n{%- block command %}{%- endblock %}\n if ($uc_output -ne $NULL) {\n $uc_output.type='result'\n }\n # Convert the result to JSON if it is a hashtable or an array so as to avoid having Automate load and dump it again.\n if (($uc_output.result -is [hashtable]) -or ($uc_output.result -is [array])) {\n # If the result is an empty array, manually set the result to the JSON representation of an empty array.\n # This is done because ConvertTo-Json will turn an empty array into a null value which makes no sense but there you are. \n if(($uc_output.result -is [array]) -and ($uc_output.result.Count -eq 0)) {\n $uc_output.result = '[]'\n }\n else {\n $uc_output.result = $uc_output.result | ConvertTo-Json -Compress:$true -Depth:25\n }\n }\n if ($internal_testing_activated) {\n try {\n $null = Stop-Transcript -ErrorAction Stop\n } catch {\n Write-Host \"Unable to stop transcription: $_\"\n }\n }\n return $uc_output\n}\n$maxRetrySeconds = 65\n$startTime = [DateTime]::now\ndo {\n $retryRequired = $false\n if ($sessionToUse -eq $null) {\n Write-Output \"No available sessions starting a new one\"\n try {\n{%- if driver_parameters.get('use_ps7') %}\n $configName = \"VOSSAutomatePSSessionConfiguration\"\n if (-not (Get-PSSessionConfiguration -Name $configName -ErrorAction SilentlyContinue)) {\n throw \"The session configuration '$configName' for Powershell 7 does not exist. Please run the PowershellProxySetup script to create it.\"\n }\n $sessionToUse = New-PsSession -Name $session_name -ComputerName $domain_name -Authentication Basic -Credential $local_credentials -ConfigurationName $configName -ErrorAction Stop\n{%- else %}\n $sessionToUse = New-PsSession -Name $session_name -ComputerName $domain_name -Authentication Basic -Credential $local_credentials -ErrorAction Stop\n{%- endif %}\n Write-Output (\"At {0} a new session was created:\" -f [DateTime]::now)\n $sessionToUse | Format-List | Write-Output\n try {\n $null = Invoke-Command -Session $sessionToUse -ScriptBlock $ExScriptBlock -ErrorAction Stop\n $null = Invoke-Command -Session $sessionToUse -ScriptBlock $functionDefinitions -ErrorAction Stop\n $uc_output = Invoke-Command -Session $sessionToUse -ScriptBlock {\n\n $internal_testing_activated = if ('{{ driver_parameters.internal_testing_activated }}' -eq 'true') { $true } else { $false }\n $internal_testing_third_party_debug_activated = if ('{{ driver_parameters.internal_testing_third_party_debug_activated }}' -eq 'true') { $true } else { $false }\n if ($internal_testing_activated -and $internal_testing_third_party_debug_activated) {\n # This allows debug messages from third party modules to be included in the output.\n $DebugPreference = \"Continue\"\n } else {\n $DebugPreference = \"SilentlyContinue\"\n }\n\n # Decode a JWT token recieved from Microsoft Teams.\n # We can only see the tokens when using a secret, not a certificate.\n function Decode-JWTToken {\n param (\n [string]$Token\n )\n # Split the token into its parts (Header, Payload, Signature)\n $TokenParts = $Token -split '\\.'\n if ($TokenParts.Length -ne 3) {\n Throw \"Invalid JWT Token format.\"\n }\n # Decode the payload (base64url-decoded)\n $Base64UrlPayload = $TokenParts[1]\n $Base64Payload = $Base64UrlPayload.Replace('-', '+').Replace('_', '/')\n switch ($Base64Payload.Length % 4) {\n 2 { $Base64Payload += '==' }\n 3 { $Base64Payload += '=' }\n }\n $DecodedPayload = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Base64Payload))\n # Convert the payload to a PowerShell object\n return $DecodedPayload | ConvertFrom-Json\n }\n\n # Work out how long until the given token expires.\n function Get-TokenExpiryDetails {\n param (\n [string]$Token\n )\n $DecodedToken = Decode-JWTToken -Token $Token\n # Ensure the 'exp' claim exists\n if (-not $DecodedToken.PSObject.Properties.Match('exp')) {\n Throw \"The 'exp' claim is missing from the token payload.\"\n }\n # Extract the expiry time (exp claim is in UNIX timestamp format)\n $ExpClaim = [int]$DecodedToken.exp\n $UnixEpoch = [datetime]\"1970-01-01T00:00:00Z\"\n $ExpiryTime = $UnixEpoch.AddSeconds($ExpClaim)\n # Calculate how many minutes until expiry\n $MinutesUntilExpiry = ($ExpiryTime - (Get-Date)).TotalMinutes\n return $MinutesUntilExpiry\n }\n\n # Run the Teams connection logic.\n # This function supports the following authentication types (in order of preference if multiple methods are configured):\n # 1. Certificate-based authentication\n # 2. Client secret-based authentication\n # 3. Basic username/password authentication\n # This function also supports setting a Teams cloud environment type if configured.\n function Connect {\n $hostname = '{{ driver_parameters.get('host', '').replace(\"'\", \"''\") }}'\n $domain_name = @{$true=$hostname; $false='.'}[[bool]'{{ driver_parameters.get('domain_name', '').replace(\"'\", \"''\") }}']\n $inet_proxy_username = '{{ driver_parameters.get('proxy_username', '').replace(\"'\", \"''\") }}'\n $inet_proxy_password = '{{ driver_parameters.get('proxy_password', '').replace(\"'\", \"''\") }}'\n $online_username = '{{ driver_parameters.get('online_username', '').replace(\"'\", \"''\") }}'\n $online_password = '{{ driver_parameters.get('online_password', '').replace(\"'\", \"''\") }}'\n $tenant_id = '{{ driver_parameters.get('tenant_id', '').replace(\"'\", \"''\") }}'\n $client_id = '{{ driver_parameters.get('client_id', '').replace(\"'\", \"''\") }}'\n $client_secret = '{{ driver_parameters.get('client_secret', '').replace(\"'\", \"''\") }}'\n $certificate_thumbprint = '{{ driver_parameters.get('certificate_thumbprint', '').replace(\"'\", \"''\") }}'\n $basic_auth_models = '{{ driver_parameters.get('basic_auth_models', '').replace(\"'\", \"''\") }}'.split(',')\n $model_type = '{{ model_type }}'\n $cloud_environment = '{{ driver_parameters.get('cloud_environment', '').replace(\"'\", \"''\") }}'\n $internal_testing_activated = if ('{{ driver_parameters.internal_testing_activated }}' -eq 'false') { $false } else { $true }\n\n{%- if driver_parameters.get('use_proxy', 'false').lower() in ('true', 't') %}\n $registryPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\"\n $proxySettings = (Get-ItemProperty -Path \"$registryPath\\Connections\" -Name DefaultConnectionSettings).DefaultConnectionSettings\n $proxyLen = $proxySettings[12]\n $proxyStart = 16\n $proxyEnd = $proxyStart + $proxyLen - 1\n $proxyString = [System.Text.Encoding]::ASCII.GetString($proxySettings[$proxyStart..$proxyEnd])\n [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy($proxyString)\n\n {%- if driver_parameters.get('use_proxy_auth', 'false').lower() in ('true', 't') %}\n $inet_proxy_securestring = New-Object -TypeName:System.Security.SecureString\n $inet_proxy_password.ToCharArray() | ForEach-Object { $inet_proxy_securestring.AppendChar($_) }\n $inet_proxy_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($inet_proxy_username, $inet_proxy_securestring)\n [System.Net.WebRequest]::DefaultWebProxy.Credentials = $inet_proxy_credentials\n $sessionOptions = New-PSSessionOption -ProxyAccessType IEConfig -ProxyAuthentication Basic -ProxyCredential $inet_proxy_credentials\n {%- else %}\n $sessionOptions = New-PSSessionOption -ProxyAccessType IEConfig\n {%- endif %}\n{%- else %}\n $sessionOptions = New-PSSessionOption\n{%- endif %}\n $online_credentials = $null\n if ($online_password) {\n $online_securestring = ConvertTo-SecureString $online_password -AsPlainText -Force\n $online_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($online_username,$online_securestring)\n }\n $app_auth_allowed = $true\n if ($model_type -in $basic_auth_models) {\n $app_auth_allowed = $false\n }\n [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n $uc_output = @{}\n $uc_output.type = 'result'\n try {\n $Params = @{}\n if ($cloud_environment) {\n $Params.TeamsEnvironmentName = $cloud_environment\n }\n if ($certificate_thumbprint -and $tenant_id -and $client_id -and $app_auth_allowed) {\n $Params.CertificateThumbprint = $certificate_thumbprint\n $Params.ApplicationId = $client_id\n $Params.TenantId = $tenant_id\n }\n elseif ($client_secret -and $tenant_id -and $client_id -and $app_auth_allowed) {\n $graphtokenBody = @{\n Grant_Type = \"client_credentials\"\n Scope = \"{{ driver_parameters.api_base }}.default\"\n Client_Id = $client_id\n Client_Secret = $client_secret\n }\n $graphToken = Invoke-RestMethod -Uri \"{{ driver_parameters.login_api_base }}$tenant_id/oauth2/v2.0/token\" -Method POST -Body $graphtokenBody | Select-Object -ExpandProperty Access_Token\n $teamstokenBody = @{\n Grant_Type = \"client_credentials\"\n Scope = \"48ac35b8-9aa8-4d74-927d-1f4a14a0b239/.default\"\n Client_Id = $client_id\n Client_Secret = $client_secret\n }\n $teamsToken = Invoke-RestMethod -Uri \"{{ driver_parameters.login_api_base }}$tenant_id/oauth2/v2.0/token\" -Method POST -Body $teamstokenBody | Select-Object -ExpandProperty Access_Token\n $Params.AccessTokens = @(\"$graphToken\", \"$teamsToken\")\n }\n elseif ($online_credentials) {\n $Params.Credential = $online_credentials\n }\n else {\n throw \"No valid authentication provided\"\n }\n if ($internal_testing_activated) {\n Write-Host \"Params: $($Params | Format-List | Out-String)\"\n } \n Connect-MicrosoftTeams @Params\n $uc_output.success = $true\n }\n catch {\n $defaultErrorText = ''\n $uc_output = Get-GenericPowerShellErrorHandling -ExceptionList $Using:Ex -DefaultErrorText $defaultErrorText -ErrorRecord $Error[0]\n if ($uc_output.result -eq '') {\n $uc_output.result = \"Failed to establish Online Session: <<<$_>>>\"\n }\n else {\n $uc_output.result = 'Failed to establish Online Session:\\n' + $uc_output.result\n }\n $uc_output.retryable = $false\n }\n return $uc_output\n }\n $result = Connect\n return $result\n } -ErrorAction Stop\n $null = Invoke-Command -Session $sessionToUse -ScriptBlock {\n # These errors will trigger a reconnection attempt if the triggering command is run though RunTeamsCmdletWithReconnection\n $reconnectionErrorStrings = @(\n \"Invalid credential\",\n \"Unauthorized\"\n )\n # Run a Teams cmdlet and attempt reconnection(s) on certain errors\n function RunTeamsCmdletWithReconnection {\n param (\n [ScriptBlock]$Cmdlet\n )\n $retryCount = 0\n $maxRetries = {{ driver_parameters.CsOnlineUser_reconnect_attempts or 1 }}\n while ($retryCount -le $maxRetries) {\n try {\n $result = & $Cmdlet\n return $result\n } catch {\n $shouldReconnect = $false\n foreach ($errorString in $reconnectionErrorStrings) {\n if ($_.Exception.Message -match [regex]::Escape($errorString)) {\n $shouldReconnect = $true\n break\n }\n }\n if ($shouldReconnect -and $retryCount -lt $maxRetries) {\n Write-Host \"Attempting reconnection...\"\n $reconnect_uc_output = Connect\n if ($reconnect_uc_output.success -ne $true) {\n throw \"Reconnection failed: $($reconnect_uc_output.result)\"\n }\n $retryCount++\n } else {\n throw $_.Exception\n }\n }\n }\n }\n } -ErrorAction Stop\n }\n catch {\n $null = Invoke-Command -NoNewScope -ScriptBlock $functionDefinitions -ErrorAction Stop\n $defaultErrorText = ''\n $uc_output = Get-GenericPowerShellErrorHandling -ExceptionList $Ex -DefaultErrorText $defaultErrorText -ErrorRecord $Error[0]\n $uc_output.type = 'result'\n if ($uc_output.result -eq '') {\n $uc_output.result = \"Failed to invoke PowerShell command in local session: <<<$_>>>\"\n }\n else {\n $uc_output.result = 'Failed to invoke PowerShell command in local session:\\n' + $uc_output.result\n }\n $uc_output.retryable = $false\n $null = Remove-PSSession $sessionToUse\n $sessionToUse = $null\n }\n }\n catch {\n $null = Invoke-Command -NoNewScope -ScriptBlock $functionDefinitions -ErrorAction Stop\n $defaultErrorText = ''\n $uc_output = Get-GenericPowerShellErrorHandling -ExceptionList $Ex -DefaultErrorText $defaultErrorText -ErrorRecord $Error[0]\n $uc_output.type = 'result'\n if ($uc_output.result -eq '') {\n $uc_output.result = \"Failed to establish local PowerShell session: <<<$_>>>\"\n }\n else {\n $uc_output.result = 'Failed to establish local PowerShell session:\\n' + $uc_output.result\n }\n $uc_output.retryable = $false\n $sessionToUse = $null\n }\n }\n else {\n Write-Output (\"At {0} we are re-using this session:\" -f [DateTime]::now)\n $sessionToUse | Format-List | Write-Output\n $uc_output = @{}\n $uc_output.success = $true\n }\n if ($sessionToUse -ne $null -and $uc_output.success -eq $true) {\n try {\n # Stop the transcript in the local session and let the remote session append to the transcript.\n if ($internal_testing_activated) {\n try {\n $null = Stop-Transcript -ErrorAction Stop\n } catch {\n Write-Host \"Unable to stop transcription: $_\"\n }\n }\n $uc_output = Invoke-Command -Session $sessionToUse -ScriptBlock $command -ArgumentList $transcription_file_name -ErrorAction Stop\n # Start the transcript again once the remote session returns. The remote session will stop the transcript before returning.\n if ($internal_testing_activated) {\n try { \n $null = Start-Transcript -Append -Path $transcription_file_name -ErrorAction Stop\n } catch {\n Write-Host \"Transcription for file \" + $transcription_file_name + \" could not be started: $_\"\n throw\n }\n }\n }\n catch {\n $null = Invoke-Command -NoNewScope -ScriptBlock $functionDefinitions -ErrorAction Stop\n $defaultErrorText = ''\n $uc_output = Get-GenericPowerShellErrorHandling -ExceptionList $Ex -DefaultErrorText $defaultErrorText -ErrorRecord $Error[0]\n $uc_output.type = 'result'\n if ($uc_output.result -eq '') {\n $uc_output.result = \"Caught exception executing remote command: <<<$_>>>\"\n }\n else {\n $uc_output.result = 'Caught exception executing remote command:\\n' + $uc_output.result\n }\n }\n $uc_output.type = 'result'\n }\n if ($uc_output.success -eq $false) {\n $duration = ([DateTime]::now - $startTime).TotalSeconds\n Write-Output ('Attempt failed after {0:0} seconds with error:' -f $duration)\n Write-Output $uc_output.result\n if ($uc_output.retryable -eq $true) {\n if (($sleepSeconds = $uc_output.delay) -gt 0) {\n Write-Output \"Sleeping $sleepSeconds\"\n Start-Sleep -Seconds $sleepSeconds\n $retryRequired = ($duration -lt $maxRetrySeconds)\n }\n else {\n $retryRequired = $true\n }\n }\n else {\n $retryRequired = $false\n }\n if ($retryRequired) {\n Write-Output 'Retrying...'\n if ($uc_output.replaceSession -eq $true) {\n Write-Output \"Removing session $($sessionToUse.Name)\"\n Remove-PSSession -Session $sessionToUse\n $sessionToUse = $null\n }\n Clear-Variable uc_output\n }\n }\n else {\n $retryRequired = $false\n }\n} while ($retryRequired)\nif ($sessionToUse) {$null = Disconnect-PSSession $sessionToUse -ErrorAction SilentlyContinue}\nWrite-Output (ConvertTo-Json -Compress:$true -Depth:25 $uc_output)\nif ($internal_testing_activated) {\n try {\n $null = Stop-Transcript -ErrorAction Stop\n } catch {\n Write-Host \"Unable to stop transcription: $_\"\n }\n}",
"pkid": "625e4b0117c55b005b18ae7b",
"hierarchy_friendly_name": "sys (System)",
"hierarchy_path": "sys"
},
"meta": {
"model_type": "data/MSTeamsOnline_powershell_envelope",
"summary_attrs": [
{
"name": "name",
"title": "Name"
},
{
"name": "hierarchy_friendly_name",
"title": "Located At",
"allow_filtering": true
}
],
"tagged_versions": [],
"tags": [
"msteamsonline",
"V4UC",
"ba_CommonOverlay"
],
"title": "default",
"business_key": {
"hierarchy": true,
"unique": [
"name"
]
},
"api_version": "21.2",
"cached": true,
"references": {
"device": [
{
"href": "",
"pkid": ""
}
],
"owner": [
{
"pkid": ""
}
],
"parent": [
{
"pkid": "6t0ggef2c0deab00hb595101",
"href": "/api/data/HierarchyNode/6t0ggef2c0deab00hb595101"
}
],
"foreign_key": [],
"self": [
{
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/",
"pkid": "625e4b0117c55b005b18ae7a"
}
]
},
"path": [
"6t0ggef2c0deab00hb595101",
"625e4b0117c55b005b18ae7a"
],
"schema_version": "1.0.0",
"actions": [
{
"update": {
"method": "PUT",
"class": "update",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/",
"support_async": true,
"title": "Modify"
}
},
{
"remove": {
"method": "DELETE",
"class": "delete",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/",
"support_async": true,
"title": "Delete"
}
},
{
"clone": {
"method": "GET",
"class": "clone",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/clone/?schema=&schema_rules=true",
"support_async": false,
"title": "Clone"
}
},
{
"export": {
"method": "GET",
"class": "export",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/export/",
"support_async": false,
"title": "Export",
"view": "/api/view/ExportData/add/",
"submit": "payload"
}
},
{
"tag": {
"method": "PATCH",
"class": "tag",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/+tag/",
"support_async": true,
"title": "Tag",
"view": "/api/view/TagNameForm/add/"
}
},
{
"tag_version": {
"method": "PATCH",
"class": "tag_version",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/+tag_version/",
"support_async": true,
"title": "Tag Version",
"view": "/api/view/TagVersionForm/add/"
}
},
{
"get": {
"method": "GET",
"class": "get",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/",
"support_async": false,
"title": "Get"
}
},
{
"help": {
"method": "GET",
"class": "help",
"href": "/api/data/MSTeamsOnline_powershell_envelope/625e4b0117c55b005b18ae7a/help",
"support_async": false,
"title": "Help"
}
}
],
"summary": "false"
},
"pkid": "625e4b0117c55b005b18ae7a"
}
]
}
(Show the first instance)
{
"data": {
"name": "bulk",
"envelope": "$internal_testing_activated = if ('{{ driver_parameters.internal_testing_activated }}' -eq 'true') { $true } else { $false }\nif ($internal_testing_activated) {\n # This feature is NOT designed for continuous use but should be turned on for a specific test and then turned off again.\n # This will include the full transcript only once the \"remote\" session returns. \n # Use the remote transcript for real time monitoring by running the commented out command below.\n # Get-Content -Path \"C:\\VOSS\\<filename>_realtime_transcript.txt\" -Wait\n $null = Start-Transcript -Path \"C:\\VOSS\\{{ execution_id }}_transcript.txt\"\n}\n$internal_testing_third_party_debug_activated = if ('{{ driver_parameters.internal_testing_third_party_debug_activated }}' -eq 'true') { $true } else { $false }\nif ($internal_testing_activated -and $internal_testing_third_party_debug_activated) {\n # This allows debug messages from third party modules to be included in the output.\n $DebugPreference = \"Continue\"\n} else {\n $DebugPreference = \"SilentlyContinue\"\n}\n\n$errorStrings = @(\n \"Invalid credential\",\n \"Unauthorized\"\n)\n\nfunction Connect {\n $uc_output = @{success=$TRUE}\n $hostname = '{{ driver_parameters.get('host', '').replace(\"'\", \"''\") }}'\n $domain_name = @{$true=$hostname; $false='.'}[[bool]'{{ driver_parameters.get('domain_name', '').replace(\"'\", \"''\") }}']\n $inet_proxy_username = '{{ driver_parameters.get('proxy_username', '').replace(\"'\", \"''\") }}'\n $inet_proxy_password = '{{ driver_parameters.get('proxy_password', '').replace(\"'\", \"''\") }}'\n $online_username = '{{ driver_parameters.get('online_username', '').replace(\"'\", \"''\") }}'\n $online_password = '{{ driver_parameters.get('online_password', '').replace(\"'\", \"''\") }}'\n $tenant_id = '{{ driver_parameters.get('tenant_id', '').replace(\"'\", \"''\") }}'\n $client_id = '{{ driver_parameters.get('client_id', '').replace(\"'\", \"''\") }}'\n $client_secret = '{{ driver_parameters.get('client_secret', '').replace(\"'\", \"''\") }}'\n $certificate_thumbprint = '{{ driver_parameters.get('certificate_thumbprint', '').replace(\"'\", \"''\") }}'\n $basic_auth_models = '{{ driver_parameters.get('basic_auth_models', '').replace(\"'\", \"''\") }}'.split(',')\n $model_type = '{{ model_type }}'\n $cloud_environment = '{{ driver_parameters.get('cloud_environment', '').replace(\"'\", \"''\") }}'\n\n {%- if driver_parameters.get('use_proxy', 'false').lower() in ('true', 't') %}\n $registryPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\"\n $proxySettings = (Get-ItemProperty -Path \"$registryPath\\Connections\" -Name DefaultConnectionSettings).DefaultConnectionSettings\n $proxyLen = $proxySettings[12]\n $proxyStart = 16\n $proxyEnd = $proxyStart + $proxyLen - 1\n $proxyString = [System.Text.Encoding]::ASCII.GetString($proxySettings[$proxyStart..$proxyEnd])\n [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy($proxyString)\n\n {%- if driver_parameters.get('use_proxy_auth', 'false').lower() in ('true', 't') %}\n $inet_proxy_securestring = New-Object -TypeName:System.Security.SecureString\n $inet_proxy_password.ToCharArray() | ForEach-Object { $inet_proxy_securestring.AppendChar($_) }\n $inet_proxy_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($inet_proxy_username, $inet_proxy_securestring)\n [System.Net.WebRequest]::DefaultWebProxy.Credentials = $inet_proxy_credentials\n $sessionOptions = New-PSSessionOption -ProxyAccessType IEConfig -ProxyAuthentication Basic -ProxyCredential $inet_proxy_credentials\n {%- else %}\n $sessionOptions = New-PSSessionOption -ProxyAccessType IEConfig\n {%- endif %}\n {%- else %}\n $sessionOptions = New-PSSessionOption\n {%- endif %}\n $online_credentials = $null\n if ($online_password) {\n $online_securestring = ConvertTo-SecureString $online_password -AsPlainText -Force\n $online_credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList:($online_username,$online_securestring)\n }\n $app_auth_allowed = $true\n if ($model_type -in $basic_auth_models) {\n $app_auth_allowed = $false\n }\n\n [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n try {\n $Params = @{}\n if ($cloud_environment) {\n $Params.TeamsEnvironmentName = $cloud_environment\n }\n if ($certificate_thumbprint -and $tenant_id -and $client_id -and $app_auth_allowed) {\n $Params.CertificateThumbprint = $certificate_thumbprint\n $Params.ApplicationId = $client_id\n $Params.TenantId = $tenant_id\n }\n elseif ($client_secret -and $tenant_id -and $client_id -and $app_auth_allowed) {\n $graphtokenBody = @{\n Grant_Type = \"client_credentials\"\n Scope = \"{{ driver_parameters.api_base }}.default\"\n Client_Id = $client_id\n Client_Secret = $client_secret\n }\n $graphToken = Invoke-RestMethod -Uri \"{{ driver_parameters.login_api_base }}$tenant_id/oauth2/v2.0/token\" -Method POST -Body $graphtokenBody | Select-Object -ExpandProperty Access_Token\n $teamstokenBody = @{\n Grant_Type = \"client_credentials\"\n Scope = \"48ac35b8-9aa8-4d74-927d-1f4a14a0b239/.default\"\n Client_Id = $client_id\n Client_Secret = $client_secret\n }\n $teamsToken = Invoke-RestMethod -Uri \"{{ driver_parameters.login_api_base }}$tenant_id/oauth2/v2.0/token\" -Method POST -Body $teamstokenBody | Select-Object -ExpandProperty Access_Token\n $Params.AccessTokens = @(\"$graphToken\", \"$teamsToken\")\n }\n elseif ($online_credentials) {\n $Params.Credential = $online_credentials\n }\n else {\n throw \"No valid authentication provided\"\n }\n if ($internal_testing_activated) {\n Write-Host \"Params: $($Params | Format-List | Out-String)\"\n }\n Connect-MicrosoftTeams @Params | out-null\n return @{success=$TRUE}\n }\n catch {\n $err_msg = 'Connection error: ' + $_.Exception.Message\n return @{success=$FALSE; result=$err_msg}\n }\n}\n\n# Bulk error handling logic to reconnect if session to Microsoft cloud drops (which it absolutely will)\nfunction Run-TeamsCmdletWithRetry {\n param (\n [ScriptBlock]$Cmdlet\n )\n\n $retryCount = 0\n $maxRetries = 1\n while ($retryCount -le $maxRetries) {\n try {\n $result = & $Cmdlet\n return $result # Exit if successful\n } catch {\n $errorMessage = $_.Exception.Message\n\n # Check if the error message matches any of the predefined error strings\n $shouldReconnect = $false\n foreach ($errorString in $errorStrings) {\n if ($errorMessage -match [regex]::Escape($errorString)) {\n $shouldReconnect = $true\n break\n }\n }\n\n if ($shouldReconnect -and $retryCount -lt $maxRetries) {\n Write-Host \"Attempting reconnection...\"\n $reconnect_uc_output = Connect\n if ($reconnect_uc_output.success -ne $true) {\n throw \"Reconnection failed: $($reconnect_uc_output.result)\"\n }\n $retryCount++\n } else {\n $customError = @{\n ErrorMessage = $errorMessage\n RetryCount = $retryCount\n }\n throw ([pscustomobject]$customError)\n }\n }\n }\n}\n\n$uc_output = @{success=$FALSE}\n$uc_output = Connect\n\ntry {\n if ($uc_output.success -eq $TRUE) {\n $input = @'\n{{ input|to_json }}\n'@ | ConvertFrom-Json\n\n # Read the input data\n # The input file is expected to be a zip file in the %TEMP% folder containing a JSON file\n $inputData = @()\n try {\n $TempPath = [System.IO.Path]::GetTempPath()\n #$TempPath = Split-Path $TempPath # Use when debugging via RDP\n $InputFilePath = Join-Path -Path $TempPath -ChildPath $input.InputFileName\n $OutputFolderPath = Join-Path -Path $TempPath -ChildPath \"{{ execution_id }}\"\n\n # Check if the input file exists\n if (-Not (Test-Path -Path $InputFilePath)) {\n throw \"File $InputFilePath does not exist.\"\n }\n\n # Overwrite any previously extracted files\n try {\n Expand-Archive -LiteralPath $InputFilePath -DestinationPath $OutputFolderPath -Force\n } catch {\n throw \"Error extracting compressed file ${InputFilePath}: $($_.Exception.Message)\"\n }\n $extractedFiles = Get-ChildItem -Path $OutputFolderPath\n if ($extractedFiles.Count -gt 1) {\n throw \"Multiple files found in compressed file $InputFilePath\"\n }\n $ExtractedFilePath = $extractedFiles[0].FullName \n # It used to work like the line below but seems to be different depending on the execution context (remote vs local script)\n #Join-Path -Path $OutputFolderPath -ChildPath $extractedFiles[0]\n\n # Read the extracted file into a variable\n try {\n $jsonData = Get-Content -Path $ExtractedFilePath | ConvertFrom-Json\n $inputData = $jsonData.InputRecords\n } catch {\n throw \"Error getting data from file ${ExtractedFilePath}: $($_.Exception.Message)\"\n }\n }\n catch {\n $err_msg = 'Error getting input data: ' + $_.Exception.Message\n $uc_output=@{success=$FALSE; result=$err_msg}\n }\n }\n\n # Perform bulk operations using $InputData\n if ($uc_output.success -eq $TRUE) {\n {%- block command %}{%- endblock %}\n }\n\n if ($uc_output -ne $NULL) {\n $uc_output.type='result'\n }\n # Convert the result to JSON if it is a hashtable or an array so as to avoid having Automate load and dump it again.\n if (($uc_output.result -is [hashtable]) -or ($uc_output.result -is [array])) {\n # If the result is an empty array, manually set the result to the JSON representation of an empty array.\n # This is done because ConvertTo-Json will turn an empty array into a null value which makes no sense but there you are. \n if(($uc_output.result -is [array]) -and ($uc_output.result.Count -eq 0)) {\n $uc_output.result = '[]'\n }\n else {\n $uc_output.result = $uc_output.result | ConvertTo-Json -Compress:$true -Depth:25\n }\n }\n\n Write-Output (ConvertTo-Json -Compress:$true -Depth:25 $uc_output)\n} finally {\n Disconnect-MicrosoftTeams | out-null\n}\n\nif ($internal_testing_activated) {\n $null = Stop-Transcript\n}",
"pkid": "6893873241f63fe774b72258"
},
"meta": {
"model_type": "data/MSTeamsOnline_powershell_envelope",
"summary_attrs": [
{
"name": "name",
"title": "Name"
},
{
"name": "hierarchy_friendly_name",
"title": "Located At",
"allow_filtering": true
}
],
"tagged_versions": [],
"tags": [
"msteamsonline",
"V4UC",
"ba_CommonOverlay"
],
"title": "bulk",
"business_key": {
"hierarchy": true,
"unique": [
"name"
]
},
"api_version": "21.2",
"cached": false,
"references": {
"parent": [
{
"href": "/api/data/HierarchyNode/6t0ggef2c0deab00hb595101",
"pkid": "6t0ggef2c0deab00hb595101"
}
],
"device": [
{
"href": "",
"pkid": ""
}
],
"foreign_key": [],
"owner": [
{
"pkid": ""
}
],
"children": [],
"self": [
{
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/",
"pkid": "6893873241f63fe774b72257"
}
]
},
"path": [
"6t0ggef2c0deab00hb595101",
"6893873241f63fe774b72257"
],
"schema_version": "1.0.0",
"actions": [
{
"update": {
"method": "PUT",
"class": "update",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Modify"
}
},
{
"remove": {
"method": "DELETE",
"class": "delete",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Delete"
}
},
{
"clone": {
"method": "GET",
"class": "clone",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/clone/?hierarchy=[hierarchy]&schema=&schema_rules=true",
"support_async": false,
"title": "Clone"
}
},
{
"export": {
"method": "GET",
"class": "export",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/export/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Export",
"view": "/api/view/ExportData/add/?auth_token=[authtoken],
"submit": "payload"
}
},
{
"tag": {
"method": "PATCH",
"class": "tag",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/+tag/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Tag",
"view": "/api/view/TagNameForm/add/?auth_token=[authtoken]
}
},
{
"tag_version": {
"method": "PATCH",
"class": "tag_version",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/+tag_version/?hierarchy=[hierarchy]",
"support_async": true,
"title": "Tag Version",
"view": "/api/view/TagVersionForm/add/?auth_token=[authtoken]
}
},
{
"get": {
"method": "GET",
"class": "get",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/?hierarchy=[hierarchy]",
"support_async": false,
"title": "Get"
}
},
{
"help": {
"method": "GET",
"class": "help",
"href": "/api/data/MSTeamsOnline_powershell_envelope/6893873241f63fe774b72257/help?hierarchy=[hierarchy]",
"support_async": false,
"title": "Help"
}
}
]
},
"pkid": "6893873241f63fe774b72257"
}
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Get the on-line Help for data/MSTeamsOnline_powershell_envelope. | GET | /api/data/MSTeamsOnline_powershell_envelope/help | hierarchy=[hierarchy] | On-line help of Model ref.: data/MSTeamsOnline_powershell_envelope as HTML |
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Transform Template | GET | /api/data/MSTeamsOnline_powershell_envelope/transform/ |
|
| Task | Call | URL | Parameters | Payload |
|---|---|---|---|---|
| Modify | PUT | /api/data/MSTeamsOnline_powershell_envelope/[pkid] | hierarchy=[hierarchy] | (For payload specification) |
For Bulk modification, refer to the Bulk Modify section.
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Delete | DELETE | /api/data/MSTeamsOnline_powershell_envelope/[pkid] | hierarchy=[hierarchy] |
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Clone instance with [pkid]. The schema rules are applied. | GET | /api/data/MSTeamsOnline_powershell_envelope/[pkid]/clone/?schema=&schema_rules=true |
|
A JSON payload with:
|
GET http://[host-proxy]/api/data/MSTeamsOnline_powershell_envelope/?hierarchy=[hierarchy]&format=json
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Get a selected [export_format] of the schema and a single instance with [pkid] of data/MSTeamsOnline_powershell_envelope; optionally with tag_version at [version] and Configuration Template as [configtemplate]. | GET | /api/data/MSTeamsOnline_powershell_envelope/[pkid]/export |
|
The response is an attachment. Refer to the list below. |
For export_format=raw_xlsx, the response is a "raw" MS Excel spreadsheet with columns corresponding to the JSON format export and a response format:
Content-Disposition: attachment; filename=<resource_type>_<resource_name>_exportedsheet_CCYY-MM-DD_HH-MM-SS.xlsx
Content-Language:en
Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
For export_format=xlsx, the response is a MS Excel spreadsheet, formatted to show all columns and a response format:
Content-Disposition: attachment; filename=<resource_type>_<resource_name>_exportedsheet_formatted_CCYY-MM-DD_HH-MM-SS.xlsx
Content-Language:en
Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
For export_format=json, the response is a time stamped zip file of data in JSON and a response format:
Content-Disposition: attachment; filename=export_2013-05-17_14:20:19.186444.json.zip
Content-Language:en
Content-Type:application/x-zip
The XLSX format can be used to bulk load instances of data/MSTeamsOnline_powershell_envelope and the JSON format can be used to import instances of data/MSTeamsOnline_powershell_envelope.
For Bulk Export, refer to the Bulk Export section.
| Task | Call | URL | Parameters | Payload |
|---|---|---|---|---|
| Tag | PATCH | /api/data/MSTeamsOnline_powershell_envelope/[pkid]/+tag | hierarchy=[hierarchy] | If payload required: |
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Get | GET | /api/data/MSTeamsOnline_powershell_envelope/[pkid] | hierarchy=[hierarchy] | The data/MSTeamsOnline_powershell_envelope instance with [pkid]. |
| Task | Call | URL | Parameters | Response |
|---|---|---|---|---|
| Help | GET | /api/data/MSTeamsOnline_powershell_envelope/[pkid]/help | hierarchy=[hierarchy] | The on-line Help for data/MSTeamsOnline_powershell_envelope. |