Introduction
How can you send weekly reports to a group of users in SharePoint? Also, how do you create an HTML table?
Step 1. Select the scheduled cloud flow.
Step 2. Add a flow name and set the schedule for the flow duration as per your requirements. For example, you can schedule it to run weekly, every Monday at 9 AM.
Step 3. Here’s how to get the group members.
-
Add the Send an HTTP request to SharePoint action to your flow.
-
Select the SharePoint Site Address that contains the group you want to email.
-
Select GET as the Method.
-
Add the above path to the Uri field. Replace the Your Group ID with the name of your group. This can include space characters.
_api/web/sitegroups/getbyid(SharepointGroupID)/users
Step 4. Select Email Addresses from HTTP Request Body
-
Add the Select action
-
In From field, add the below expression
body('Send_an_HTTP_request_to_SharePoint')['d']['results']
-
Now add email in the Map field with the below expression
item()['Email']
-
Now the output will come for select action as below. It means the email comes in an array with commas separated. But for sending an email, we need the semicolon; Separated email address so follow the next step. Example of output : ["[email protected]","[email protected]","[email protected]"]
Step 5. Join Email Addresses
This will create a semicolon-separated list of email addresses.
-
Add the Join action
-
In From field, add the Output from the Select.
-
Add a semicolon; in the Join field
-
Now the below output will come from the join action:
Example: [email protected];[email protected];[email protected]
Step 6. Get the reports from a list.
Add the Get Items action and collect the data from a SharePoint list.
Step 7. Create a table of report
-
Add Create HTML table action
-
In From field, add a Value of Get Items
outputs('Get_items_-_Idea_List')?['body/value']
-
In the column dropdown, select a Custom
-
Now add the header and value as per your requirements.
-
Add CSS if you need better UI Using Compose action.
<style>
table {
border: 1px solid #1C6EA4;
background-color: #EEEEEE;
width: 100%;
text-align: left;
border-collapse: collapse;
}
table td, table th {
border: 1px solid #AAAAAA;
padding: 3px 2px;
}
table tbody td {
font-size: 13px;
}
table thead {
background: #1C6EA4;
border-bottom: 2px solid #444444;
}
table thead th {
font-size: 15px;
font-weight: bold;
color: #FFFFFF;
border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
border-left: none;
}
</style>
Step 8. Send an Email to Group Members
-
Add Send an Email (V2) action
-
In the To field, add the output of the Join action. Below is an expression of the output.
body('Join')
-
In the Mail body before the output of Create HTML Table, add the output of Style (Means add CSS)
-
Then add an Output of Create HTML Table
Conclusion
In this article, we have learned how to effectively send weekly reports to a group of users in SharePoint, as well as the process of creating HTML tables for data presentation.