Get Picture From SharePoint Image Column Using Power Automate

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and a very warm welcome to a quick tutorial in which we are going to understand the image column in SharePoint list the use case of the scenario would be to capture this image and add it into an HTML such that you can save the list item and the image as a file in a different SharePoint document library that being said let's quickly try to create a power automate so as this is a demonstration I'll select a manual trigger and I assume that you are thinking that it will be relatively easy right uh you just type in SharePoint um see more and choose maybe get item to the get item I can pass it the site URL I can pass it the list name as well and then I can pass it the identify in this case the identifier is one so I will have coded I want to add another action say compose such that I can get the you know the file content or at least the file URL of the picture column so I'll click here and I'll click on and I see very limited columns out here in fact I see 39 but let's try to find my column that is profile picture and it's not visible right so what I can do is actually let me get rid of this action and let's try to run a flow I'll quickly test the flow to see if at all I can get the information so I'll click on get items let me copy the body open up a notepad and try to paste the body in in the body I don't find the profile picture column that means it is not returned by power automate so whenever some something like this happens I usually go ahead and try to use the rest API but before we use the rest API we need to understand the basics right when I click on this image it gives me a URL but the URL does not make a lot of sense out here if I copy this URL and put it in the notepad it looks like this so it does not actually tell me where is the image stored it tells me that it is in drives right let's try to hack a little bit more let's try to click on this let's try to click on the element and here as well it tells me it doesn't give me the actual location it gives me the same old link so the next Resort that we can take is the API so what I'll do is that I'll try to do the rest API I'll say underscore API forward slash I'll say list get items and I'll use the picture demo list name and I'll say get me the first item as soon as I hit enter here I can let me actually go ahead and increase the zoom here do I get anything related to profile picture so here I get some more context about the profile picture right I also get the server related URL if I just want to get data about the profile picture I can just Add profile picture after this and this actually gives me the correct URL now let's go to this location and check if the file actually exist so I'll make a duplicate of this let me paste it in and let me just remove the last bit of it right the jpeg file and here if you see the image is visible so perfect right we get the image location and it's stored in the site assets understand this it's located under the site asset sets list and then a guid so what is the guid out here right so let's try to understand the guid as well so I go to list settings and under the list settings I have a list ID right so if I remove the 7B and the last three characters from the guid and I paste it in a notepad it gives me this particular number if I go to the site assets and the list and I check the guid out here it should match the guid that I just copied so it is 37 32 and it ends with 2 a so understand this my friends this is the list GID so whenever you have a picture it's stored in the site assets it's stored in a folder named as list and then the GID of your list right and under that you can find your images so now that's all good and let's navigate back to Power automate and create a flow such that we can get that image so as I told you we need to do a rest request so I'm going to type in SharePoint and let's use the send HTTP action let me give this a site name a method that's good and let me give it the URL that we just created right so if if I go back here and if I openend this URL with the forward slash it should give me the server related to URL and that is what I'm interested in so let me run it and let me try to test it so I'll click on test and let me run it manually let's see the output of the send HTTP action so I need the body I can take this body right copy it and let me pass Json out of it so I'll use the pass Json action to get the Json add action so add the pass Json action out here the content would be the output or the body of the HTTP action let me use a sample payload that I just copied and let me click on done and let me go and log this output into the compose action so I log the body which has the profile picture and I'll click on Save let's see if we can get the server related URL out of it right now perfect so as of now it seems that I have still not got the server related URL so let's do another thing let's try to pass it again so what I'm going to do is I'm going going to go ahead and add an action and type in pass let me go and pass pass the Json and to this I will pass the output of let's say the body profile picture and I'll test it so this time it seems that I'm getting some meaningful output so what I'm going to do I'm going to add another compos and to this compose we now we now get the body server related URL so this is what we need to go ahead and get the image and let's test it yes this is what we needed and this is what we have right now so that's awesome let's go ahead and get the file content right so to get the file content what I I need to do is I need to use the get file content using path action to this action I'll pass it my site URL and I'll pass in the dynamic content that is the body server related to URL I can click on Save and let me try to test it again perfect so I can also get the file content out here so this is awesome now let's finally go ahead and try to add this to an HTML so to display it at a compose and this time I'll give this composer name create HTM and I'm going to paste in some code out here right so let me paste in some code sample code out here let me change this paragraph with the title perfect and I'll change this part right this part let me change this part with the output of the get file content action right file content so I'm going to use the file content and I can click on Save and now if I click on test you should have an HTML in the compose action which looks like this now if you see there's some encoding problem so we need to understand that let's go ahead and decorate this let's add a function let's say that base 64 and to this function let's go ahead and add a dynamic value as file content and click on ADD finally let's go ahead and save this file in SharePoint so I'll say create file let me add the file to the PDFs folder let me give the file a name let me give it a dynamic name so let's say that I can type in title maybe do HTML and the file content will be the output of the HTML action so let's save it and this should be the movement of Truth for us if our solution worked or if it did not so I'm going to click on manual I'm going to click on test and I'll click on run and done perfect so it worked so it should create the file in the PDF's folder so let me navigate to the PDF's folder and here we have an HTML let me quickly try to click on this HTML and it seems that for some reason the image is broken mhm that's odd so let me go back into my power automate and let me quickly judge this right so if I look out here it's seems that I missed a comma right so let me go into the compose and you know this is very important this format is very very important in hurry I missed a comma or the comma actually got added at the end I'll save it again and let me try to test it again before I test it I'll just get rid of this file perfect so test run done if I go back here the file is created that is awesome and here my friends you have the image and you have the title I hope this session was informative thank you for your time have a great day and bye-bye
Info
Channel: Clavin Fernandes
Views: 2,880
Rating: undefined out of 5
Keywords:
Id: GVi4ubxcmTg
Channel Id: undefined
Length: 11min 44sec (704 seconds)
Published: Sun Feb 04 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.