cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kklink
Level: Powered On

Read multi-day calendar events

Hi there! I have a perfectly working Flow that reads and outputs events daily from a SharePoint calendar to a Microsoft Team. What I've noticed is that events that last over multiple days don't get posted. A user @maxze  stated that they found a solution, but I'm unsure how to work that into my current code. Here is their solution followed by my code. Any thoughts?

EventDate lt 'checkedDate' and EndDate gt 'checkedDate'
EventDate ge '@{utcNow('yyyy-MM-ddT00:00:00Z')}' and EventDate lt '@{addDays(utcNow(),1,'yyyy-MM-ddT00:00:00Z')}'

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Read multi-day calendar events

Hi @kklink try this:

 

((EventDate le 'EXPRESSION FOR START DATE') and (EndDate ge 'EXPRESSION FOR END DATE')) and EventType eq 0

EXPRESSION FOR START DATE: formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')
EXPRESSION FOR END DATE: formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')

 If you have found this post useful, please give it a thumbs up. If it has answered your question, please accept it as the solution so others can benefit.

@MattWeston365





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

20 REPLIES 20
Super User
Super User

Re: Read multi-day calendar events

Hi @kklink am I right in thinking that the scenario is this:

 

You have an event that runs from Monday to Wednesday

On Monday, the event is posted to Teams

On Tuesday, the event is posted to Teams

On Wednesday, the event is posted to Teams





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

kklink
Level: Powered On

Re: Read multi-day calendar events

Sort of. Currently my Flow posts events that are listed for that day. Ex. A 1-day event listed for today would be listed, but an event that was a three-day event Wed-Friday wouldn't be listed today (but would have yesterday).

Super User
Super User

Re: Read multi-day calendar events

Thanks for the clarification @kklink. Just so I can put my sample Flow together, are you storing the events in an Outlook Calendar or a SharePoint Calendar?





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

Community Support Team
Community Support Team

Re: Read multi-day calendar events

Hi @kklink ,

 

The issue could be reproduced by me.

 

When using Filter query of action Get items, it only returns events that for today, multiple day events won’t be listed.

 

I have figured out a workaround by using action Send an HTTP request to SharePoint.

 

In the action, select your Site address, and set Method as Get.

 

Input the following code in the Uri field, which will return all the events within current month:

_api/lists/getByTitle('TestCalendar')/items?$select=Title,EventDate,EndDate&$filter=EventDate ge '@{startOfMonth(utcNow())}'&EventDate le '@{utcNow('yyyy-MM-ddT00:00:00Z')}'& EndDate ge '@{addDays(utcNow(),1,'yyyy-MM-ddT00:00:00Z')}'

An image for your reference:

1.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365 i am storing events in a sharepoint calendar.

 

kklink
Level: Powered On

Re: Read multi-day calendar events

@v-yamao-msft i'm not sure what you mean to do. i am trying to post multi-day events, not the entire month.

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365 were you able to look at this any further?

Super User
Super User

Re: Read multi-day calendar events

Hi @kklink give this a whirl in your Get Items action:

 

 

EventDate le 'EXPRESSION FOR START DATE' and EndDate ge 'EXPRESSION FOR END DATE'

EXPRESSION FOR START DATE: formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')
EXPRESSION FOR END DATE: formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')

 

 

Here is my calendar in SharePoint:

Calendar.PNG

Here is my GetItems action

GetItems.PNG

The result is that it will return events that are either happening today, or spanning through today.

 

Let me know how you get on with that

 

If you have found this post useful, please give it a thumbs up. If it has answered your question, please accept it as the solution so others can benefit.

@MattWeston365





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365  so it worked and didn't work. it grabbed today's events, but it also posted any recurring events such as holidays very far into the future (such as christmas). any thoughts?

kklink
Level: Powered On

Re: Read multi-day calendar events

By the way, thank you very much for your help!

kklink
Level: Powered On

Re: Read multi-day calendar events

so reading into this a little more, it seems the expression you suggest pulls every event ever that is less than or equal to today and everything that occurs today or later. would i have to have a limit on that?

Super User
Super User

Re: Read multi-day calendar events

You shouldn't need to put a limit on it unless you have a huge number of items being returned on each given day. I'm quite surprised that it's handling recurrence as usually recurring events only exist in the list once, and then the rendering code in SharePoint generates the repeated events.

 

So upon investigation, the reason that it's showing up is that it shows the start date as the first entry in the recurrence, and then then end date at the end of recurrence. So I have created an entry in the calendar for Christmas Day 2018, with yearly recurrence. The end day has therefore been entered as Christmas Day 2167 (I'd love one of my Flows to still be running then!)

 

If the event is a one off, then it will be given an event type of 0, if it repeats, it's getting 1, so we can include that in the condition to filter out those repeating events. The unfortunate thing that I can't see a solution for at the moment is to detect if the repeated event occurs today. 

 

I'll have a dig around, but even when I was doing more development, recurring events were always a thing of nightmares.

 

If you have found this post useful, please give it a thumbs up. If it has answered your question, please accept it as the solution so others can benefit.

@MattWeston365

 

 





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365 thanks again. how would i go about including that filter in that set up?

Super User
Super User

Re: Read multi-day calendar events

Hi @kklink try this:

 

((EventDate le 'EXPRESSION FOR START DATE') and (EndDate ge 'EXPRESSION FOR END DATE')) and EventType eq 0

EXPRESSION FOR START DATE: formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')
EXPRESSION FOR END DATE: formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')

 If you have found this post useful, please give it a thumbs up. If it has answered your question, please accept it as the solution so others can benefit.

@MattWeston365





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365 so this did work, but i think i'm going to play around with it to see if i can get it to pick up recurring events the right way. i have my existing solution which doesn't pick up multi-day events, and then this new one that can but is designed not to pick up recurring events hahaha. there has to be a way of making both possible.

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365  have you had any success with this? i haven't found out a way to limit the repeating events that are occurring today yet.

Super User
Super User

Re: Read multi-day calendar events

Hi @kklink thanks for the reminder. I'm testing out some logic at the moment which may be able to help use resolve this. I'll report back shortly.





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365 thank you for continuing to look into this. i was toying with an "if-then" statement or an "and" one but couldn't get the language right. maybe have separate branches? i haven't been able to give it more attention until now, but i'm still looking for a solution.

kklink
Level: Powered On

Re: Read multi-day calendar events

@MattWeston365 any progress on your logic?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,563)