0

In the SharePoint list, I have a column let's say "Month". I want that every month this list creates and displays as many items as there are days in that month in this column. Let's say July has 31 days. At the start of July, there will be 31 items in that list and every item displays one date, as the first item on a list is 07/01/2021 and the second one 07/02/2021, etc. until the last one is 07/31/2021. Is there any way to do this? I know the calendar exists but the rest of my intentions doesn't sit well with that.

3

You can achieve this using Power Automate. (Reference: Get Days of the Month)

Use the Recurrence trigger and set it to get executed every month. enter image description here Below is the complete flow.

  1. Save the Start of the month in compose action.

    startOfMonth(utcNow())

enter image description here

  1. Save the End of the month in the compose action. subtractFromTime(startOfMonth(addToTime(outputs('StartofTheMonth'),1,'Month')),1,'Day') enter image description here

  2. Initialize variable to set Start_Date as string and value of output #1 compose.

  3. Initialize an array - as array output of #1 compose. This is going to be used to loop through between the date range.

enter image description here

  • Create Do Until loop - set 'StartDate' and compare output value with 'EndOfTheMonth' compose action i.e. #2 step

  • Create compose action again to add 1 day into start date with expression as follows : addDays(variables('StartDate'),1)

  • Now add action to set variable value of 'StartDate' from previous compose output.

  • Add append to array variable - Select 'DateArray' with the value of 'StartDate' - This is going to append array variable.

enter image description here

  1. Loop through the DateArray and create items in the SharePoint list.

enter image description here

Items are created in the List as below.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.