web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to get the last cr...
Power Apps
Answered

How to get the last created events of my calendar?

(0) ShareShare
ReportReport
Posted on by 293

Hi! I'm using a powerapp to manage meetings rooms.


I need to be able to get the LAST created outlook meetings of my calendar and collect them. This is what I'm using but for some reason it doesn't prioritize the last created ones therefore when there's too many of them the last created ones are being left out when I want the exact opposite to happen. This is the code to get them:

 

ClearCollect(
 MyCalendarEvents;
 Sort(
 Office365Outlook.GetEventsCalendarViewV3(
 
 MyCalendar;
 Text(
 _minDate;
 UTC
 );
 Text(
 _maxDate;
 UTC
 );{'$orderby': "createdDateTime"}
 ).value
 ; createdDateTime;Descending))

 

I though that by using 'orderby' my problem would've be solved. Is the first time I'm using Odata so I may be doing it wrong. 
Please save me 😁

Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @FacundoGorla ,

    Since the Start and End dates are all in UTC time zone, please ensure the latest event in the calendar you want is within that time period, notice the difference in time zone.

    Beside that, I found the orderby query doesn't work on DateTime Field, but it works fine on other fields, such as the Subject field. I suggest you give up using this orderby query although I'm really confused with this.

    I would suggest you set the maxdate to large enough, and try with the following code to see if the last event show in the collection.

    ClearCollect(
     MyLastCalendarEvents;
     First(Sort(
     Office365Outlook.GetEventsCalendarViewV3(
     MyCalendar;
     Text(
     _minDate;
     UTC
     );
     Text(
     _maxDate;
     UTC
     )
     ).value
     ; createdDateTime;Descending)))

    If this still doesn't work, How many events do you have in this time period? Can Office365Outlook.GetEventsCalendarViewV3() function get all events?

    Hope this helps

    Sik

  • Verified answer
    FacundoGorla Profile Picture
    293 on at

    Thanks for your reply!

    The min Date is set for 2020-01-05 and the max Date is a year from today.
    I tried your formula, actually that was the one I used originally until I realize it wasn't getting all the events.

     

    I did a CountRow for MyLastCalendarEvents and the result is 256. I never knew about this limit, is it impossible to get more than 256 events from a calendar with this function?

    I know there's more than 256 meetings in that time frame. And the biggest problem is that it doesn't get the last created ones first. therefore leaving the most recent ones out of the system.

    Update: I use '$top' in the function and set it to 500 or 2000 and now there's 409 events. And I think there's no one missing. So it seems that by default it only gets 256? on the official documentation it says that if you don't use $top it would get ALL the events but doesn't seems like it.

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @FacundoGorla ,

     

    I think the Document has fooled us, I also thought the default top is all.

    Does your issue been fixed when you set the Top to 500/2000? If so, please accept the answer as the solution to help other members find it quickly.

    Sik

  • FacundoGorla Profile Picture
    293 on at

    I have 410 events and it does get them all. 
    But I'm afraid it still won't prioritize the last created ones and if I hit the next limit (500 or 2000) I'll encounter the same issue. 
    If someone with more events than myself would try to do this the $top solution won't be enough, for now it works for me.

    Thanks for the help, I'll mark the solution.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard