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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,254)