cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Get events from next month SharePoint list and email them

Hi,

 

i've seen some tutorials to achieve this, but i'm an absolute beginner at Microsof Flow. What i'd like to achieve is that Flow wil get all the events for the next month from my SharePoint list called 'events' and email them (in a table, or perhaps store a PDF in a library, but that is for later).

 

In this SharePoint list there's a column called 'startdate'. This is a date-only column. 

 

Is there a step-by-step tutorial available to achieve this? 

 

  1. Our Office365 environment is not english, which sometimes makes it harder to translate 
  2. Not always sure what date format to use. When trying in one step i used this '
    utcNow('dd-MM-yyyy') because we 15-12-2018 is our date format. 
     
    Thnx in advance!

 

 

4 REPLIES 4
Highlighted
Solution Sage
Solution Sage

Re: Get events from next month SharePoint list and email them

Hi @henkprins

 

This is one approach I'd take to achieve what you're looking for:

 

  1. For the first step, I'm using a Recurrence trigger, and it's set to run every day.
    GetEvents-1.PNG

  2. The next step is a Data Operations - Compose, which I renamed to Get First Day of Next Month. This step contains the expression below and this is how it works: using the getFutureTime() function, it gets today's date, but next month. It then gets the first day of the month by using the startOfMonth() function and formats the date output as 4-digit year, 2-digit month, and 2-digit day (yyyy-MM-dd). Note: using 2 uppercase MM in the date, it gives the 2-digit month. This link provides information about date formatting.
    startOfMonth(getFutureTime(1, 'Month'),'yyyy-MM-dd')
    GetEvents-2.PNG

  3. The next step is a Data Operations - Compose, which I renamed to Get Last Day of Next Month. This step contains the expression below and this is how it works: using the getFutureTime() function, it gets today's date, but 2 months from now. It then gets the first day of the month by using the startOfMonth() function, and once the first day of the month is available in the output, the expressions subtracts a day using the addDays() function and the -1 in the parameter. It finally formats the date output as 4-digit year, 2-digit month, and 2-digit day (yyyy-MM-dd).
    addDays(startOfMonth(getFutureTime(2, 'Month')),-1, 'yyyy-MM-dd')
    GetEvents-3.PNG

  4. The next step is a SharePoint - Get items actions. I selected the Site Address and the List, and then clicked on Show advanced options so I could configure the Filter Query. What the Filter Query does is retrieve the specifict items which StartDate is greater than or equals to the Output from the Get First Day of Next Month step AND StartDate is less than or equals to the Output from the Get Last Day of Next Month step. Please note that both Outputs are wrapped in single quotes.
    GetEvents-4.PNG

  5. The next step is a Data Operations - Select, which I renamed to Select Events. In the *From field, I selected the values from the SharePoint - Get items action, and for the *Map, I created the keys: Event Title, Start Date, and Event Details. Each key is mapped to the respective SharePoint column.
    GetEvents-5.PNG

  6. The next step is a Create HTML table. The *From field uses the Output from the Select Events above; *Include headers is set to Yes, and *Columns is set to Automatic.
    GetEvents-6.PNG

  7. The next and final step is an Outlook - Send an email (V2). In this step, I selected an email address and a subject, and for the Body, I selected the Output from the Create HTML table step above.
    GetEvents-7.PNG

  8. The screenshot below shows what the email body looks like after it's received.
    GetEvents-8.PNG

Please do not hesitate to reach out if you have any questions.

 

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Highlighted
Frequent Visitor

Re: Get events from next month SharePoint list and email them

Hi Fausto,

 

sorry for my late reply, but: Thanks! Will look into this tomorrow and will let you know it i succeeded or have any questions. Realle appreciating your effort!

 

henk.

Highlighted
Frequent Visitor

Re: Get events from next month SharePoint list and email them

Hello Fausto,

 

due to a vacation and an issue at poweruser.microsoft.com ( https://powerusers.microsoft.com/t5/Help-with-the-Forum/Re-Are-YOU-a-member-of-your-local-Flow-User-... ) i wasn't able to respond earlier.

 

But it works now: really appreciating your respond and time!

 

Best regards, henk.

Highlighted
Super User III
Super User III

Re: Get events from next month SharePoint list and email them

@henkprins:

 

I agree with @faustocapellanj - his response is on point and works great.

However, if the list that you are using is a SharePoint calendar, I believe that you'll have issues with recurring events.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,066)