cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yukonn
Advocate III
Advocate III

Image with Blob

Hi,

 

       I got this message when i link image with blob value. "the property expects image values, but this rule produces incompatible Blob Values". How do i convert blob to image compatible value at PowerApps?

 

Regards,

Yukon

12 REPLIES 12
Mike8
Memorable Member
Memorable Member

Hello,

Kind of the same issue here. Could someone help, please?

Thank you

Also having this issue.. has anyone found a solution?

Hi,

 

Can you please provide an example of what you are trying to do?

 

Thanks!

Cherie

shahar
Frequent Visitor

I have the same issue.  In my case, I built a custom connector to Microsoft Graph API.  One of the path calls /photo/$value - which returns a binary value.  (I'm aware of the existing Office 365 connector, but that connector GetPhoto() function doesn't work in my configuration.)

If you are using a custom API/connector, you've provided a Swagger/OpenAPI file.

When you specify the response for an operation to be binary, you specify like this:

"responses": {
  "200": {
    "description": "Success",
    "schema": {
      "type": "file",
      "x-ms-media-kind": "image"
    }
  }
}

 

The default for the x-ms-media-kind is "blob". But it can also be set to "image" or "media". This is the same extension that is supported when specifying a file upload that should be an "image" vs any sort of file.

 

shahar
Frequent Visitor

Hi,

 

thanks for your help on this.

First, let me comment that in my world of PowerApps I can only use Swagger 2.0 syntax as in

"responses": {

  "200": {

    "description": "Success",

    "schema": {

      "type": "string",

      "format": "file",

      "x-ms-media-kind": "image"

    }

  }

But, this does not work.  the returned content type is not a file.  It is text/plain, but really it is binary data.  With a different format, such as the "file" or "image" the Power App replies with an error message: "The Response Type returned is invalid.  Expected JSON," which probably indicates an attempt by the system to read binary data into a string.

}

Have you tried using the response schema I gave? It is valid Swagger for describing when a response body should be treated as a file, not as json data.

 

With the schema: { type: "string" ... }, this means the body is expected to be a json string. But your body is actually some arbitrary file.

 

 

shahar
Frequent Visitor

I did. It is not a valid swagger 2.0 syntax. The type=file is rejected upon clicing Update Connector.

Hrm, so I created a mock Swagger file that will download files of different media-kind's. The Swagger has three operations:

  1. downloadFile
  2. downloadImage
  3. downloadAudio

When I try to bind the output of these operations to an Image control's 'Image' property I get the same error "The property expects Image values, but this rule produces incompatible Blob values." (or "...Media values." for the downloadAudio operation).

 

When I use downloadImage() function I do not get the error.

 

Here's the swagger I used:

{
"swagger": "2.0",
  "info": {
    "title": "downloadMediaKindExamples",
    "description": "mock example API to show how to write download operations using x-ms-media-kind.",
    "version": "1.0"
  },
  "host": "www.tempuri.org",
  "basePath": "/mock/api",
  "schemes": [
    "https"
  ],
  "parameters": {
    "entityId": {
      "name": "entityId",
      "in": "path",
      "required": true,
      "type": "integer"
    }
  },
  "paths": {
    "/files/{entityId}/binary/$value": {
      "get": {
        "operationId": "downloadFile",
        "parameters": [
          {
            "$ref": "#/parameters/entityId"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "file"
            }
          }
        }
      }
    },
    "/photos/{entityId}/binary/$value": {
      "get": {
        "operationId": "downloadPhoto",
        "parameters": [
          {
            "$ref": "#/parameters/entityId"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "file",
              "x-ms-media-kind": "image"
            }
          }
        }
      }
    },
    "/audio/{entityId}/binary/$value": {
      "get": {
        "operationId": "downloadAudio",
        "parameters": [
          {
            "$ref": "#/parameters/entityId"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "file",
              "x-ms-media-kind": "audio"
            }
          }
        }
      }
    }
  },
  "definitions": {}
}

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,193)