Can't get last Outlook emails

Hi,

I have another problem with the outlook “Get many messages” node.
At first, I wanted to get all emails from one year ago to today. So I used this filter:

ReceivedDateTime ge {{ $now.minus({ years: 1, days: 1 }) }} and isDraft eq false

and checked “Return all”

First problem, I got the error " Query option ‘$filter’ was specified more than once, but it must be specified at most once.":

When I uncheck “Return all” and set the limit to 500, which is the maximum, it works:

But then… here is the second problem: it returns older emails first. But in my case, with a limit of 500, it never reaches the end of the list, so the newer emails…

After some search, there is no filter to set the order, it’s another parameter that is not implemented in n8n. The node surely use the url /messages?$filter=ReceivedDateTime... but should use /messages?$orderby=receivedDateTime desc$filter=ReceivedDateTime...

Is there something I can do for my problem ?

Hi @CodeRider883 :wave: I’ve tried the same query, and I’m not getting any errors when trying to execute it with ‘return all’ - what version of n8n are you running? I’m trying this out on 0.233.1:

You could use a HTTP request node instead to have both $filter and $orderby parameters, too, but I’m curious why that expression with “return all” isn’t working for you :thinking:

Hi, I forgot to say something: it seems to have something to do with the number of returned items.
After some tests, it works until 99 but crash at >= 100 items.
In your exemple, you have 2 items, so it will not trigger the error.

99 items returned:


More items (I added just one hour):

Hey @CodeRider883,

That looks like we might be making a mistake with our pagination code and not removing the query when using the next url provided by the outlook API.

We have created a bug ticket for this internally and I will look into it properly early next week. For now you could possibly use an http request node to manually fetch them which isn’t ideal.

1 Like

Thank, sorry for the workload… :smile:
I will wait for the fix then, don’t want to mess with http request, auth, etc.

2 Likes

No problem at all, I am surprised it has taken this long for this to pop up it seems like something that should be fairly common.

Hi ! :slight_smile:
I just want to know if there is some news about it ?

Hey @CodeRider883,

It is still in my todo list some other higher priority issues came in, I will get this one sorted later today or tomorrow.

Hi!
I don’t want to bother you, especially as I know you’ve got other priorities, just to see if there’s any chance that the problem will be solved soon?
If not, I’m going to try going straight to the APIs, because my 2 workflows have been at a standstill since the beginning of July… :smile:

Hey @CodeRider883,

We are actually almost finished on an overhaul of the Outlook node so this may be fixed as part of that.

1 Like

Great! I’m really looking forward to the update :smiley:

Hi, I see yesterday that it was live, so I jumped right into my n8n to try and… it works!
Absolutly fantastic, thanks! :smiley:
Just a note, I just see that there is no Outlook trigger like there is on Gmail, is this planned?

1 Like

Hey @CodeRider883,

I have not seen anything planned but the imap trigger might do the job.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.