web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :

PowerApps Image to SharePoint

aprildunnam Profile Picture Posted by aprildunnam 704

JSONtoImage.png

Title: PowerApps Image to SharePoint

Description: This Flow will allow you to take an image uploaded from PowerApps with the Image control and upload it to a SharePoint Document library using the JSON function in PowerApps.

Detailed Instructions: In your PowerApp, you need to convert your image to JSON so that you can pass that JSON to Flow.  Insert an Add an Image Control in PowerApps and add a button with the following formula:

 

Collect(
image,
{
picture: UploadedImage1.Image,
Name: Rand() & ".jpg"
}
);
Set(
varJSON,
Json
JSON(
image,
JSONFormat.IncludeBinaryData
)
);
Set(
imageLink,
JSONtoImage.Run(varJSON).imagelink
);

 

The first formula will take your uploaded image and add it to a collection with the file and the name of the file.  The second formula takes the image from the collection, converts it to JSON and assigns it to a variable.  The final formula is executing the Flow, passing in the JSON to the Flow and is setting the newly created link to the image in a variable.


Questions: I am open to answering questions about this Flow. Please ask right here as a reply.

Anything else we should know: This is a great solution to take your images from PowerApps and upload them to SharePoint.

 

Categories:

Comments

  • SayanikaSM Profile Picture SayanikaSM Microsoft Employee
    Posted at
    PowerApps Image to SharePoint

    Hi,

     

    I am using the following steps. But its not converting the file. Not sure if image URI is not correct

     

    Thanks

  • dsadler Profile Picture dsadler
    Posted at
    PowerApps Image to SharePoint

    Great video! I'm actually using something similar to this in a custom form I have for a SharePoint.  My form saves and image and I use JSON to parse it and then save to SharePoint. I do have a problem somewhere in my Flow in where the JSON is  not converting to an image file when I add the file to SharePoint list. It saves the JSON content to list, not the actual file. However, when I go through the same process and add the image file to a SharePoint library everything works fine. Is there an issue with saving to a SharePoint list vs. SharePoint library? Is there a work around? Am I missing something?

    Thanks in advance. 

    DS

  • mrpowergage Profile Picture mrpowergage 234
    Posted at
    PowerApps Image to SharePoint

    looking at this a bit more, I am getting the flow running twice, seconds apart, which is creating the two copies. I presume this is something to do with the onChange property of the text recogniser button.

     

    I have solved this by moving the code to the form submit button.

  • mrpowergage Profile Picture mrpowergage 234
    Posted at
    PowerApps Image to SharePoint

    apologies, missed the datauri to binary step. Image is saving succesfully

    I'm still getting two copies of the receipt (not sure why). asside from that everything seems to be working fine, but I'm still getting the error showing in powerapps

  • mrpowergage Profile Picture mrpowergage 234
    Posted at
    PowerApps Image to SharePoint

    (deleted)

  • mrpowergage Profile Picture mrpowergage 234
    Posted at
    PowerApps Image to SharePoint

    (deleted)

  • mrpowergage Profile Picture mrpowergage 234
    Posted at
    PowerApps Image to SharePoint

    Many thanks for this.

     

    I'm using it for the text recogniser AI.

    I've got the flow working, however it is creating two files, and neither seem to be valid jpeg files.

     

    Powerapps is giving this error:

    New_Entry_-_Saved__Unpublished__-_Power_Apps.png

    This is what I've got in powerapps:
     
    Collect(
    image,
    {
    picture: ScanReceipt.OriginalImage,
    Name: Rand() & ".jpg"
    }
    );
    Set(varJSON, JSON(image,JSONFormat.IncludeBinaryData)
    );
    Set(imageLink,JSONtoImage_v3.Run(varJSON).imagelink);
     
    Any help greatfully received