cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kklink
Helper I
Helper I

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

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

21 REPLIES 21

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

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

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

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.

@MattWeston365 i am storing events in a sharepoint calendar.

 

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

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

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

@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?

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

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?

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

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

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

View solution in original post

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

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

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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

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

@MattWeston365 any progress on your logic?

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (55,398)