How to Send Weekly Reports to a Group of Users in SharePoint?

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.

How to Send Weekly Reports to a Group of Users in SharePoint?

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.

How to Send Weekly Reports to a Group of Users in SharePoint?

Step 3. Here’s how to get the group members.

  1. Add the Send an HTTP request to SharePoint action to your flow.

  2. Select the SharePoint Site Address that contains the group you want to email.

  3. Select GET as the Method.

  4. 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

  1. Add the Select action

  2. In From field, add the below expression 

    body('Send_an_HTTP_request_to_SharePoint')['d']['results']
  3. Now add email in the Map field with the below expression 

    item()['Email']
  4. 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.

  1. Add the Join action

  2. In From field, add the Output from the Select.

  3. Add a semicolon; in the Join field

  4. 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.

How to Send Weekly Reports to a Group of Users in SharePoint?

Step 7. Create a table of report

  1. Add Create HTML table action

  2. In From field, add a Value of Get Items 

    outputs('Get_items_-_Idea_List')?['body/value']
  3. In the column dropdown, select a Custom

  4. Now add the header and value as per your requirements.

  5. 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  

  1. Add Send an Email (V2) action

  2. In the To field, add the output of the Join action. Below is an expression of the output.

    body('Join')
  3. In the Mail body before the output of Create HTML Table, add the output of Style (Means add CSS)

  4. 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.


Similar Articles