We have created a custom start page as a winform and are trying to recreate the Recent Documents feature from the default page. It successfully pulls orders in, but they are not consistently in the correct order. Most commonly listing the most recently opened order as the 2nd item rather than the first. What is the correct approach to always get the list of recently opened orders in the correct order?
For the functionality that you're trying to implement, I would suggest using the IEnvICE.RecentDocuments property. It should return the collection of the recent documents sorted from most recent to least recent.
You'll see the 2nd method GetRecentOrders() is the one that does the work of getting the RecentDocuments. I found however this doesn't give me only Order Documents so I do some checking that it is actually an order in the IsOrder() method by checking that the URI contains an orderId. Then sorting by the last access date. But as mentioned this does not reliably order the results.
This issue seems to have resolved itself at this time.
But to piggy back on this post:
Using the same code as posted above, it appears that templates do not show up in list returned from envIce.RecentDocuments.
Is there any way to get templates to show up in recent documents results (or another approach to retrieve them)?
I looked at the source code and it appears that you are getting the same list whether you log in with IEnvICE or with the Select client. The list is kept in a user AppData folder on the machine the client code runs. Perhaps you are logging in with different IDs or the same user ID but different machines? In either case, don't depend on the MRU list contents. It is a convenience feature and should not be depended on for critical production code.