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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Outlook "Get calendar ...
Power Automate
Unanswered

Outlook "Get calendar view of events" order by odata error

(5) ShareShare
ReportReport
Posted on by 78

Hi there,

 

I created a flow a while back to send me an agenda every evening for my next day's meetings. On 12/18 my flow started to fail with the following error:

 

The $orderby expression must evaluate to a single value of primitive type.

 

I noticed that I was using a deprecated "v2" version of the "Get calendar view of events" operation, so I replaced it with v3 but it continued to fail.

 

My "Order By" ODATA query statement previously was "IsAllDay desc, Start asc", but this no longer works (even when changing the case to be "isAllDay desc, start asc" according to the updated syntax) -- it results in the error above, about which I am not finding much info online.

 

Incidentally, I tried to add the two columns to the "Filter Query" ODATA query as some articles indicated that may be necessary, but I couldn't seem to get that syntax right, either -- I get "Invalid filter query" no matter what I put, so I'm guessing I'm way off on the syntax.

 

I was able to get the operation to stop failing by removing the "start asc" part of the Order By (so, leaving only "isAllDay desc"), which is kind of counter-intuitive. I also don't trust that the ordering will actually be correct, though, without enforcing the "start" order as well.

 

What am I missing here?

Categories:
I have the same question (0)
  • jbedfordp Profile Picture
    78 on at

    Couldn't figure out how to just paste screenshots (sigh...), so here's imgur links...

     

    The full flow: https://imgur.com/HYwO93Z

     

    The "Get calendar view ..." operation configuration that works: https://imgur.com/xOTSEzE

     

    Operation w/ error inputs: https://imgur.com/b5kHM7H

     

    Operation w/ error outputs: https://imgur.com/syN2b1S

     

    Text of the Output:

    {
    "status": 400,
    "message": "The $orderby expression must evaluate to a single value of primitive type.\r\nclientRequestId: 45dcf805-dedb-4d7b-a508-6a5baf50f100\r\nserviceRequestId: f9060cee-2b1d-4537-9e84-6300b237aed0",
    "error": {
    "message": "The $orderby expression must evaluate to a single value of primitive type."
    },
    "source": "office365-eus2.azconn-eus2-01.p.azurewebsites.net"
    }
  • jbedfordp Profile Picture
    78 on at

    This is where I got the idea about filters being required, but that's clearly not necessary due to the operation working with an Order By of "isAllDay desc" without any corresponding filter:

     

    https://developer.microsoft.com/en-us/office/blogs/update-to-filtering-and-sorting-rest-api/

  • v-bacao-msft Profile Picture
    on at

     

    Hi @jbedfordp ,

     

    When configuring the Order By field of the Get calendar view of events (V3) action, we can only configure a single field and cannot configure multiple fields for sorting.

    230.PNG

    When configuring Filter Query, we can use multiple fields as filters and combine them with and/or.

     

    Best Regards,

  • jbedfordp Profile Picture
    78 on at

    That's an unfortunate annoyance. This definitely worked in the V2 version of the action until 12/18. Why add this limitation?

     

    Is there a recommended alternative method to sort this data?

  • jbedfordp Profile Picture
    78 on at

    Also, perhaps the documentation should be updated to reflect this?

    https://docs.microsoft.com/en-us/connectors/office365/#get-calendar-view-of-events-(v3)

    ODATA orderBy queries do not have this restriction.

  • jbedfordp Profile Picture
    78 on at

    I tried changing the Order By to be only "start asc" (without the "isAllDay desc" part), and I got the same error as in my original post.

    How do I properly sort in this Action by the events' start time?

  • cpolanish Profile Picture
    17 on at

    While this may be part of the problem, I'm not sure it is the entire problem. I happened to have basically the same Flow for myself that has been working fine for months, except I only had a single orderBy defined - "start asc", and now suddenly I'm getting the same error as in the original post, beginning roughly around the same time. Interestingly, if I only pass in "isAllDay desc" as a test, the Flow runs fine, but if I pass in the orderBy filter I want "start asc" the Flow fails.

     

    OrderBy Error.png

     

     

     

    {
     "status": 400,
     "message": "The $orderby expression must evaluate to a single value of primitive type.\r\nclientRequestId: 8e393424-69a1-41e5-9c82-7f452467c39a\r\nserviceRequestId: 182c491f-8330-4224-bf8a-bf1d5eed5a42",
     "error": {
     "message": "The $orderby expression must evaluate to a single value of primitive type."
     },
     "source": "office365-wus.azconn-wus-01.p.azurewebsites.net"
    }

     

     

     

  • jbedfordp Profile Picture
    78 on at

    I wonder if it has to do with the type/format of the "start" property? Perhaps the Order By can no longer handle whatever the datetime type is? Maybe there's a way to convert it to something sortable like a string or number...

  • jbedfordp Profile Picture
    78 on at

    I have utterly failed to get any kind of filter or orderby to work with start or end fields. I've tried every different syntax that I can imagine... with or without single quotes, with simple datetime formats, etc.

     

    E.g., in the Filter ODATA query like: start gt 2001-01-01 or start gt '2001-01-01' or start ge '2001-01-01T01:01:01Z' and with/without the '.000' microsecond extension, etc. etc. etc.

     

    Have gotten absolutely no date filters to work, so I have no idea what the syntax is supposed to be. 

     

    Similarly, a simple Order By of start asc does not work, nor does Order By of start

     

    I did find one article which perhaps is relevant? https://stackoverflow.com/questions/50930871/how-to-use-filter-in-microsoft-graph-api-to-get-sharepoint-items indicates that maybe these fields start and end need to be indexed in order to be filtered? I can't imagine I have the ability to add indexes to internal Outlook properties, though...

  • v-bacao-msft Profile Picture
    on at

     

    Hi @jbedfordp ,

     

    Sorry, my previous statement was wrong. Order by supports sorting events based on multiple fields.

     

    But there are requirements for the type of the field, as mentioned in the error message "single value of primitive type."

     

    It seems that the start field is an unsupported type.

     

    Best Regards,

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard