Send Multiple SharePoint Images to Email from SharePoint in HTML Table with Power Automate

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so here it is here's my new email brought in all four lines of SharePoint brought in the image column resize the image so it fits in the Box we could play with this more we could center it we could center every column we could adjust the widths of the rows but this is the basic structure it's about an HTML table with image columns from your SharePoint and send it to your email [Music] all right so I have a very basic flow it's a manual trigger manual trigger you can set up your trigger how you want if you want it scheduled or if you wanted a button click or however you want to set up your trigger and then I have two string variables alright so I just set up two string variables and this is going to be for my CSS because I want to make a pretty HTML table and then this is going to be for another variable that we'll use later on now our first step to get the columns and the images from SharePoint is a get item step so we're going to do get items from SharePoint and we want get items not get item think about that right we want all of the items or based on a filter query so we're going to use our SharePoint site for me it's called task list and the list name is called my image list so if I go to SharePoint you can see I have a SharePoint site called task list and my list name is called my image list and we are not going to do any filter queries or anything like that you can do that if you want to do a filter query or top count if you want the top five or something like that you you can do that on your git items now we want to do an HTTP request to SharePoint to SharePoint I saw it right there at the top and I'm going to do my SharePoint site name so that's the task list and then the URI and you can see it's giving us an example right here we're pretty much going to do very close to the same thing so we're just going to do underscore API slash lists slash get by title and it is going to be the name of our SharePoint list which is my image list my image list now if you add spaces to your your list name you may run into other issues you can normally find your list name in the URL of your SharePoint site but mine is just my image list try and cut out the spaces and then a single quote ending parentheses slash items and in between your parentheses here we are going to use the ID and it's going to put it and apply to each right because there's many items and then we need an ending parenthesis there all right so that's our HTTP request next we're going to parse Json so when we do a request it's going to come through as Json now we're going to parse Json and actually before we even parse Json we want to generate a schema let me show you how you generate a schema easily we're going to go to compose and do a compose operation and we're going to pull in this HTTP request of the body we're going to pull that in I have to delete it delete this in order to keep going and I'm going to just run the flow one time manually all right so I'm running the flow it does give me a warning it's saying hey you know maybe put in a filter query I only have three items we're fine for right now during testing okay we ran that through and if we go to our compose action and we go to the outputs and we copy all of this right here so copy your entire outputs this is going to be our schema for our Json this makes it so much easier for us so if we go to Json and generate from sample right here just paste in that output so for the content of the Json we want to make sure not the get items body we want to make sure it's that HTT request body right here okay and maybe we can even rename this parse Json just so we know because I'm going to have two of them parse HTTP Json okay so now I'm going to run another compose action this time I want to get it for the image I want to compose and I'll just search for image and it's my image column so that's you know SharePoint once again just repeating myimage column that's what I'm pulling in from the parse Json and then I'm just going to do a manual test and the reason we're doing this is because we want to generate another schema off of that image column okay so now this compose has a new output I'm going to take it so let's see if I can highlight I just press Ctrl a I'll just copy that edit and now I'm going to do another parse Json Json there we go so parse Json I'm going to generate from sample click ok so the content for this one is going to be your image column so it's going to be my image column here so this is parse image Json and then parse HTTP Json so now we can actually delete these composes we don't need them we were just using them to generate our schema okay and I'm just going to hit save for right now okay so next what we want to do is do a git file content step so from SharePoint I'm going to get file content and there's a few different ones in here I'm going to do git file content Point Blank and the site address is going to be the same site and the file identifier this is where it gets a little tricky we're going to do encode URI component and then we're going to do a replace in there so then replace and then in between the replace we're going to put in the server relative URI from the image Json so from the image Json I'll pull in the server related a relative URL and then after this bracket what we're going to do is we're going to put in a a comma and then we're going to do a single quote and then slash sites slash your SharePoint list then we'll do another comma and two double quotes and click ok so we put that in there um I will put this in the properties of the video next what I'm going to do is I'm just going to test it with an image and an email so I'm going to send myself an email just to see if I got all this part right so send email and we're going to click in the top right to say code View and it kind of puts in some paragraphs in there that's fine right here I'm just going to put in I'm going to put in Brackets image SRC equals data image slash PNG base64 and then we need a comma and then I'm going to pull in an expression base64. in between the parentheses we're going to put the file content and click ok and then I'm going to do a single quote in or double quote to end the double quotes slash greater than and then I'm going to try it off now I probably will get three emails because I have three rows in my SharePoint list but I just want to see if these emails come through all right so I'm going to test manually I'm going to do another manual test and I'm going to run flow and then we're going to check out the email let's see if those images come through so it looks like they're already coming through very quickly so boom we have one image two image and third image is probably coming not sure where it is just a little delayed I could see that I did get three emails let's see if I refresh there it is there's my third image that's me okay so we got the image part working now the next part is the fun part let's make it look good I'm going to put it in an HTML table and we're going to do some CSS and make it look perfect all right so now we're on part two now I try to do this many different ways now the first thing I try to do was I wanted to build an HTML table so there's a step in here right so HTML there's a step in here to create an HTML table this did not work for me and and when I researched on it it said you know oh the HTML table can't hold complex HTML in there so I couldn't put that base64 in there but what I did is I built my own HTML table so at the beginning of my power automate I initialized two variables the first one is CSS so this is going to be what changes the colors of my HTML table I just found this online so this was just a table I found online the next one is variable title this is going to be the header of my table so in order to do this all I'm going to do is initialize a table in HTML so I'm going to say table and then TR I'm just identifying The Columns so TR is one line one row across and then th is going to be the header of my table and that's going to be the title first I believe let me double check SharePoint title approved classification my image column so title and then slash th approved oh I typed in and wrong let's try this again th approved uh th again classification and then finally my image column now I'm just manually building this HTML table instead of using the action because it wouldn't work for me so if you want to try that out you can but this is a good practice anyways to create your own HTML table now I did that now I need one more variable I need to initialize and this is going to Loop through all of my rows so I'm going to do one more variable initialize variable and we'll call it um variable rows just to you know make that easy on us it's a string it might be let me see variable rows now and apply to each this is where we're going to Loop through and go through all of our rows right so we're going to say right here a a append to string variable so in my variable rows what we're going to do is we're going to say TR TD I'm just building the HTML now first is the title and then we're going to end with a TD then TD again and the next column was proved classification so the next column is approved and we probably want to pull in the parse Json actually I just realized that that's why we did that we're going to pull in the parse Json title and then TD here so it is very important that you click on the right um one so classification Ed and then TD um the last one was my image column so for the last column that's going to be our our image in order to do that I'm going to do a different step here I'm going to compose so I'm going to compose and the inputs is going to be what I put here in the HTML so I'm just going to take this right here we created this in part one I'm just going to copy that I'm going to put it in the compose action and then for my image column I'm going to put in the outputs of the compose right so the outputs of the compose slash TD end it okay so now we have our rows now my email I'm going to pull it out of the for Loop so let me just um back up a little let me zoom out a little bit there we go so my email I'm going to pull it out of the for Loop and then in the email instead of this I'm going to build my HTML table so first we're going to do our CSS then we're going to do the title bar the header and then we're going to do the rows okay so now we're getting the images we're applying to each we've pulled all that out let's go ahead and test let's see how we did I'm just going to do a manual all right I have a new email it came through you can see I now have a nice table this image is a little bit too big maybe we can work on that but we can see we have a nice table here um with a gray background and our columns so I saw that the image was a little bit big let's see if we can fix that so let's see if we can go to our our compose action so I'm going to go back to edit in HTML so I'm going to say width equals let's try 100 height equals 100 and let's resend it let's see if we can resize that image so it fits better in our email and that might be too small but we can we can figure that out what size image we want in our email all right so we're just going to run the flow again let it run through it's going to Loop through it's going to find those pictures find the rows and SharePoint it's going to send us an email and you can see now the images are actually the same size more uniform we can see this uh this HTML we could probably make this even better you know we could center things we can change colors but you can see now we have a table coming through in an email looping through SharePoint and bringing in the images along with it so one thing you can do in your outlook box if you select view image email Source you can see that HTML coming in here so here's the HTML here's our CSS that came through and then next we started our table body with our th's and our TRS so we started our table body and then it looped through every row and brought on the image width image height and that's what we built in power automate we built out that HTML manually without the create HTML action we built it out manually and it pastes it right into our email makes a nice table you could do this for every week you could do this for every day do a top count or filter query based on your created date I really think this is useful thank you all for watching my name is Andrew Hess please like And subscribe I'll see you next week
Info
Channel: Andrew Hess - MySPQuestions
Views: 4,043
Rating: undefined out of 5
Keywords: power automate, html css email, create a table from sharepoint, send email of sharepoint list items, loop through sharepoint and email, email all items from sharepoint, create table from sharepoint to email, parse json of http request, http request from sharepoint, automate sharepoint list to emails, create flow to send table from sharepoint, how to create a power automate to email, myspquestions, Multiple SharePoint Images to Email from SharePoint in HTML
Id: JFArR8XO-E0
Channel Id: undefined
Length: 16min 24sec (984 seconds)
Published: Mon Jul 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.