I am running a process that is moving D365 email attachments to azure blob storage.
There are hundreds of thousands of attachments so I need to speed it up.
Due some limits I have to pluck them off one by one and am using the following to do so.
The problem is I need to create a second one that starts at the bottom or grabs the top record where the sort is back created on date desc.
How do I need this so that I can filter on the email entity's created on date?
Keep in mind the email entity is an expanded query and is a separate d365 table than attachment.
Attachment does not have a createdon or modifiedon date I can sort by,
I get an error saying the property does not exist if I add createdon desc in the sort by field.
How can I add a desc order by email createdon desc or an order by email createdon asc to this?