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

Add-MediaType

  • Dark
    Light
  • PDF

Article summary

Summary

Creates a new media type.

Add-MediaType
    -Entry

Returns a media type object.

Parameters

ParameterTypeRequired?Notes
EntryMedia Type ObjectYes

Examples

Create a new media type

# Create a new media type

# Create an object with the necessary fields to create the media type
# Note: The name field is the only required system field for the media type object

$entry = @{
    Name = "SFTP File Share"
}

# Create the media type. The created entry will be returned back.
$data = Add-MediaType -Entry $entry

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

# 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 (SFTP File Share) was created

JSON Results:
{
  "MediaTypeId": 16,
  "Name": "SFTP File Share",
  "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:50:06.3941473+00:00",
  "LastUpdatedBy": null
}

What's Next