RecentDocuments Class
Provides methods to manage Windows Recent Documents.
public static class RecentDocumentsMethods
| Name | Description |
|---|---|
| AddToRecentDocuments(string) | Notifies the system that an item has been accessed, for the purposes of tracking those items used most recently and most frequently. |
| AddToRecentDocuments(string, string) | Notifies the system that an item has been accessed by the application identified by applicationUserModelId, for the purposes of tracking those items used most recently and most frequently. |
| ClearRecentDocuments() | Clears all usage data on all items. |
AddToRecentDocuments overloads
AddToRecentDocuments(string)
RecentDocuments.cs- Supported on windows5.1.2600
Notifies the system that an item has been accessed, for the purposes of tracking those items used most recently and most frequently.
[SupportedOSPlatform("windows5.1.2600")]
public static void AddToRecentDocuments(string path)Parameters
pathstring- The path to the document that has been accessed. A relative path is resolved against the current directory.
Exceptions
ArgumentNullExceptionpathisnull.ArgumentExceptionpathis empty or contains a null character.
Remarks
The item is added to the user's Recent Items and to the Jump List of the application associated with the current process.
Executable (.exe) files are accepted but never appear in Recent Items. Folders only appear in the File Explorer Jump List.
If the application is not registered to handle the file type, Windows may register it for that file type for the current user.
AddToRecentDocuments(string, string)
RecentDocuments.cs- Supported on windows6.1
Notifies the system that an item has been accessed by the application identified by applicationUserModelId, for the purposes of tracking those items used most recently and most frequently.
[SupportedOSPlatform("windows6.1")]
public static void AddToRecentDocuments(string path, string applicationUserModelId)Parameters
pathstring- The path to the document that has been accessed. A relative path is resolved against the current directory.
applicationUserModelIdstring- The Application User Model ID (AppUserModelID) of the application whose Jump List receives the item.
Exceptions
ArgumentNullExceptionpathorapplicationUserModelIdisnull.ArgumentExceptionpathis empty, contains a null character, or does not identify an existing item; orapplicationUserModelIdis empty, longer than 128 characters, or contains a space or a null character.
Remarks
Use this overload when the Jump List belongs to a different identity than the current process, for instance when the application sets an explicit AppUserModelID or is started through dotnet app.dll.
Executable (.exe) files are accepted but never appear in Recent Items. Folders only appear in the File Explorer Jump List.
ClearRecentDocuments()
RecentDocuments.cs- Supported on windows5.1.2600
Clears all usage data on all items.
[SupportedOSPlatform("windows5.1.2600")]
public static void ClearRecentDocuments()Remarks
This is not limited to the calling application: it empties the user's Recent Items and the Recent and Frequent lists of every application's Jump List. It cannot be undone.