Azure / Microsoft365R

R SDK for interacting with Microsoft 365 APIs
Other
318 stars 46 forks source link

"By" parameter in list_emails() not working #176

Closed iagocnunes closed 9 months ago

iagocnunes commented 1 year ago

Hi, both "received" and "received desc" are returning the same email. Is there a problem with the function?

library(Microsoft365R)
my_outlook <- get_business_outlook()
email <- my_outlook$list_emails(by = "received desc", filter = "startswith(sender/emailAddress/address,'test')", n = 1)
email <- my_outlook$list_emails(by = "received", filter = "startswith(sender/emailAddress/address,'test')", n = 1)
hongooi73 commented 1 year ago

The by arg only works if you don't supply filter and search; see the documentation for ?ms_outlook_folder. This is a limitation of the underlying Graph API. You can retrieve the filtered list and then sort it in R, as a workaround.