Adding, Deleting and Viewing Recent Documents

Gain access to the Shell's Recent Documents Collection in .NET

Recent Documents Demonstration Application

All versions of the Windows Shell offer access to the Recent Documents interface. This sample demonstrates how to use the Recent Documents API along with the ShellLink code to get full access to add, clear and view items in the list.

The Recent Documents API

There is one function associated with the Recent Documents list: SHAddToRecentDocs allows you to add files and also, rather contrarily, to clear the entire list. In addition to this, you will find that the Shell uses shortcuts to store a user's recent documents in a special folder; the path of this can be retrieved using the System.Environment.GetFolderPath method using the SpecialFolder.Recent value.

To make this API more .NET friendly, the download code contains a RecentDocuments class which in provides access to a strongly-typed collection of RecentDocument items in the list.