Skip to content

ODataService CreateMedia

Create Media action is used to create one or multiple OData Media Entities with Media Link (an OData EntityType with HasStream="true" attribute). This action is not supported in ChangeSet.

Note: This action cannot be used to upload data stream of OData property with "Edm.Stream" type of an EntityType. Please use Action.Type.ODataService.UploadStream instead.

The properties defined in Action are also applicable to this action.

ODataService CreateMedia Properties

Property Type Required
Headers object Optional
Media object[] Required
Properties object Optional
RequestOptions RequestOptions Optional
Target Target Required
_Type const Required


Custom headers to be included as part of the request to the OData Service in key/value pair format

  • type: object


If the array contains multiple items, multiple Media Entities will be created.

  • type: object[]

The actual value of the media. Should be in this format {"content":binary, "contentType":string}.


A list of the target entity's property names and values in key/value pairs format. Complex property type is supported.

  • type: object


Options for processing of data requests



  • type: const

The value of this property must be equal to:


Action Result

The ActionResult of this action is a JS array of OData media entities.


OData Media entity

"Product" EntityType is a Media Entity and it has an associated media stream (could be a product image):

<EntityType Name="Product" HasStream="true">
    <PropertyRef Name="ID"/>
  <Property Name="ID" Type="Edm.String" Nullable="false"/>
  <Property Name="Name" Type="Edm.String" Nullable="false"/>
  <Property Name="Price" Type="Edm.Decimal" Nullable="false"/>
<EntitySet Name="Products" EntityType="MyODataModel.Product"/>

Note: Each entity can only have a single associated media stream. With this action, you can create "Product" entity and at the same time upload a media file (e.g. an image) to it.

CreateMedia with documents from Attachment control

  "_Type": "Action.Type.ODataService.CreateMedia",
  "Target" : {
    "Service" : "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Products"
  "Properties" : {
    "ID": "#Control:IDCtrl/#Value",
    "Name": "#Control:NameCtrl/#Value",
    "Price": "#Control:PriceCtrl/#Value"
  "Media": "#Control:Attachment/#Value"

CreateMedia with Signature image from Signature control

  "_Type": "Action.Type.ODataService.CreateMedia",
  "Target": {
    "Service": "/MyMDKApp/Services/MyOData.service",
    "EntitySet": "Products"
  "Properties": {
    "ID": "#Control:IDCtrl/#Value",
    "Name": "#Control:NameCtrl/#Value",
    "Price": "#Control:PriceCtrl/#Value",
  "Media": ["#Control:SignatureCell/#Value"]