Fetch commands that support the fetchorder parameter allow you to specify the order in which the events and todos are returned.
Three sorting choices can be specified:
Ascending order
Descending order
Special (or legacy) sorting order–This sorting choice returns things in mostly ascending order.
The sorting logic is as follows:
For events, put in order according to dtstart. If two events have the same dtstart date, then compare dtend for the two events. Return the one that fits the desired sort order. If they are the same, compare uid and return the components from the least value to the highest.
For todos, all completed tasks are returned after all sorted not-due tasks. For two not-due tasks, compare dtdue. Return in the desired sort order. If they are the same, compare uid and return components from the least value to the highest. For descending sorts, some overdue tasks could be truncated because of the maxResults limit.
For recurring components sorted in ascending order, the master record is returned first and then the exceptions. Depending on the maxResults limit, some exceptions could be truncated. In this case, error 81 is given. (See Error Handling.)
For recurring components sorted in descending order, exceptions are returned first and then the master record. Depending on the maxResults limit, it is possible for a master record to be truncated. In this case, error 81 is given. (See Error Handling.)