3

In Windows 10 or possibly lesser windows versions, there is a 'quick access' icon that shows up when you have documents folder open on the left side. I just want to get the names of each item in that 'quick access' list and put it .ToList();, how do I do this?
PS, I'm not trying to add a folder to quick access like the other answered questions in these links: Is it possible programmatically add folders to the Windows 10 Quick Access panel in the explorer window?

How to programmatically add a folder to Favorites in Windows File Explorer

I'm trying to get the names of each item on that panel, not add folders to it.

windows quick access

Community
  • 1
  • 1
Ozymandias
  • 51
  • 6
  • Please read [ask] and try searching before asking a question, and include that research in your question. There's no API for what you want, see duplicate. – CodeCaster Dec 08 '16 at 20:41
  • well, nvm I read the post and yea it answers this question – Ozymandias Dec 08 '16 at 20:46
  • 1
    Whether you want to add, delete, edit or list items does not matter, the principle remains the same: there's no API, because then every other application would add itself to it. You can probably list it by iterating the relevant registry keys. – CodeCaster Dec 08 '16 at 21:07

1 Answers1

2

Here is some code that dumps it to the console:

// get this: https://learn.microsoft.com/en-us/windows/win32/shell/shell-application
dynamic shell = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));

// this is Quick Access folder id
var CLSID_HomeFolder = new Guid("679f85cb-0220-4080-b29b-5540cc05aab6");
var quickAccess = shell.Namespace("shell:::" + CLSID_HomeFolder.ToString("B"));
foreach (var item in quickAccess.Items())
{
    var grouping = (int)item.ExtendedProperty("System.Home.Grouping");
    switch (grouping)
    {
        case 1:
            Console.WriteLine("Frequent: " + item.Name + " path: " + item.Path);
            break;

        case 2:
            Console.WriteLine("Recent: " + item.Name + " path: " + item.Path);
            break;

        default:
            Console.WriteLine("Unspecified: " + item.Name + " path: " + item.Path);
            break;
    }
}
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • Could you explain why the extendedproperty is 'System.Home.Grouping'? Cause i'm not able to get any information about this property or 'System.Home' class. – Hellagur May 12 '23 at 02:40
  • @Hellagur - indeed, this property is not officially documented by Microsoft – Simon Mourier May 12 '23 at 06:48
  • Thanks for your reply! Cause i found the file group differs between win10 and win11. In win10 it's 2 while in win11 it's 3, which really made me confused. – Hellagur May 13 '23 at 06:32