Following my previous post about adding variables into Adaptive cards, I had a few requests from people asking how the image (of a beautiful German Shepherd!) was retrieved from SharePoint.
So in this post, we’ll go in details about getting the SharePoint hosted image with the (agent) flow 🙂
SharePoint list
For context, the SharePoint list is called DogBreeds, and looks like the below:

Agent flow
Get data
In the SharePoint list, the field is an Image type (adds a nice visual for the list items), and because we were using the Agent flow in a topic, the trigger was When an agent calls the flow.

Next, we need to get the list items, and we have a few Power Automate actions:
- Get Item
- Get Items (with query)
- HTTP Request to SharePoint (with query)
The Get Item action is going to ask for the Id because we’re trying to retrieve a specific item, which we won’t have in our case (only the DogBreed input). Let’s not complicate things and forget about this one.
The Get Items (plural) with a filter query seems promising. In the Power Automate and SharePoint world, this action is used A LOT.

If we run the flow, we expect our properties to be there. However, if we look at the outputs of this action, the DogImage field is missing 😥
Hence, the HTTP Request to SharePoint with a filter query is what we’ll use to get the data we need.


Image Url
If you look at the above screenshot, you’ll see that the DogImage field value is going to be difficult to use in this current form. So let’s modify it to only get the name: “Reserved_ImageAttachment […]“
Add a Compose action, and using the JSON() function, we’ll be able to extract the value we require. Below is formula (change to your own previous action name):
json(outputs('Get_dog_breeds_data')?['body/d/results']?[0]?['DogImage'])?['fileName']

Finally, let’s add another Compose to construct the URL to send back to Copilot Studio as an output. The syntax will be:
https://<TENANT-NAME>.sharepoint.com/sites/<SITE-NAME>/lists/<LIST-NAME>/Attachments/<Id-FROM-HTTP-REQUEST>/<OUTPUT-PREVIOUS-COMPOSE>
My ImageUrl will be:
https://<TENANT-NAME>.sharepoint.com/sites/BlogDemo/lists/DogBreeds/Attachments/@{outputs('Get_dog_breeds_data')?['body/d/results']?[0]?['Id']}/@{outputs('DogImage')}

Respond to the agent
Passing back the outputs of the ImageUrl action, we’re able to send a string, which is directly usable as a variable in the topic. That is, without worrying about any form of quotes required in the Adaptive card.

Thanks for reading! 🙂