How to

clear recent documents

Published: 27. January 2009 | Updated: 26. September 2011
License: Microsoft Public License (MS-PL)
Categories: File system, Windows » Win32
Tags: C# Win32 Windows
Was this snippet helpful for you? YESYES / NONO
Get Analyzant!

Check your entire website from code to content in minutes with Analyzant, the free analysis suite.

Free download at

Import namespace

using System.Runtime.InteropServices;


public static extern void SHAddToRecentDocs(ShellAddToRecentDocsFlags flag, IntPtr pidl);

public enum ShellAddToRecentDocsFlags
    Pidl = 0x001,
    Path = 0x002,


// clear recent files
SHAddToRecentDocs(ShellAddToRecentDocsFlags.Pidl, IntPtr.Zero);
Send us feedback about this snippet »

Related Snippets: