Set-MediaType
  • 1 Minute to read
  • Dark
    Light
  • PDF

Set-MediaType

  • Dark
    Light
  • PDF

Article summary

Summary

Updates an existing media type.

Set-MediaType
    -Entry

Returns a media type object.

Parameters

ParameterTypeRequired?Notes
EntryMedia Type ObjectYes

Examples

Update an existing media type

# Update an existing media type

# A common flow for updating existing data is to first retrieve the data using the GET
# command, update specific fields, and then provide the modified data back using the SET command.

$entry = Get-MediaType -Id 16

# Update the "Name" system field:
$entry.Name = "Secure File Transfer Protocol (SFTP)"

# Save the modified media type
$data = Set-MediaType -Entry $entry

# Output some information to help indicate that the media type was updated
Write-Output "Media type $($data.MediaTypeId) ($($data.Name)) was updated"

# For debug purposes, convert the data to output as JSON so we can see all the fields
Write-Output ""
Write-Output "JSON Results:"

$jsonOutput = $data | ConvertTo-Json -Depth 10

# Output the data
Write-Output $jsonOutput

Execution results:

Media type 16 (Secure File Transfer Protocol (SFTP)) was updated

JSON Results:
{
  "MediaTypeId": 16,
  "Name": "Secure File Transfer Protocol (SFTP)",
  "NumberOfMediaLogs": 0,
  "CreatedByFullName": "Max Miller",
  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "CreatedOn": "2024-04-18T12:50:06.3941473+00:00",
  "CreatedBy": null,
  "LastUpdatedByFullName": "Max Miller",
  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "LastUpdatedOn": "2024-04-18T12:53:02.7660779+00:00",
  "LastUpdatedBy": null
}