PowerAutomate / Save Image from Internet in SharePoint Library

We want to retrieve an image from the Internet and add it to a directory in the SharePoint library

We want to retrieve an image from the Internet and add it to a directory in the SharePoint library.

To do this, we’re going to rely on a Flow that fetches the image via an HTTP call, then a PowerApps page that calls the Flow.

Get Image and Save in SharePoint with PowerAutomate

1. Create a Instant cloud flow (+New flow > Instant cloud flow)

2. Select When Power Apps calls a flow (V2) trigger and click on Create

3. Add Text input parameters ImageUri and ImageName to trigger

4. Add a new action under the trigger and select HTTP action from HTTP connector

5. Set URI parameter with ImageUri and ImageName variable

In code :

uri: @{triggerBody()?['text']}@{triggerBody()?['text_1']}
method: GET

When the HTTP action is executed, we’ll get this response:

{
  "$content-type": "image/jpeg",
  "$content": "CONTENT OF IMAGE"
}

In the next step, we will extract the variable $content to create our new file in SharePoint.

6. Add Create File Action from SharePoint connector

7. Set the following parameters

  • Site Adress : Your SharePoint Site
  • Folder Path : Your Documents Library folder
  • File Name : ImageName from Trigger
  • FileContent : base64ToBinary(body(‘HTTP’)?[‘$content’])

In File Content, We retrieve our image with the variable $content from the HTTP action. But first we need to convert it to Binary from Base64 format

8. Save your flow

Call Flow from PowerApps

9. Add the new Flow and select SaveImageInSharePoint flow

10. Add an Input Control with following properties.

This control will be used to set the image address

Name : inImageUri

11. Add a new Input Control :

Name :  inImageName

The user can enter the image name in this Input control

12. Add a button Control named btnSaveImage

You must have the following page with 2 input controls and the button action

13. in OnSelect property of the new button :

SaveImageInSharepoint.Run(
   inImageUri.Value, inImageName.Value
)

14. You can execute with F5 Mode

Share the Post:

Related Posts

PowerApps Patch Date

Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.

Read More »

PowerApps Mettre à jour une date

Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.

Read More »

PowerApps Patch / Update

Patch is the Swiss army knife for updating data in SharePoint. You need to specify which record you wish to update. Different methods are then possible.

Read More »

PowerApps Patch / Add new data

Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.

Read More »