I am using Shell32 in a C# app to get extended properties from files in multiple directories (specifically from pictures across many folders). A technique I found here on SO (that works great) for doing this is:
public static void Main(string[] args)
{
List<string> arrHeaders = new List<string>();
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder objFolder;
objFolder = shell.NameSpace(@"C:\temp\testprop");
for( int i = 0; i < short.MaxValue; i++ )
{
string header = objFolder.GetDetailsOf(null, i);
if (String.IsNullOrEmpty(header))
break;
arrHeaders.Add(header);
}
foreach(Shell32.FolderItem2 item in objFolder.Items())
{
for (int i = 0; i < arrHeaders.Count; i++)
{
Console.WriteLine(
$"{i}\t{arrHeaders[i]}: {objFolder.GetDetailsOf(item, i)}");
}
}
}
I did a little investigation and it looks like the attribute names (not their values, obviously) are the same across all of the folders on my C: drive. Does anyone know if I can count on this? (I'm using Windows 10.) There doesn't seem to be a lot of good Microsoft documentation that I could find .
[Edit] I wrote a quick program to scan all of the directories I could and then count how many of them had which attributes. Here is the result; I'm not sure what it tells me, other than most, but not all, of the attributes are common across most (but not all) folders:
Attribute Directories
------------------------- -----------
# 203485
Album 203485
Attributes 203485
Authors 203485
Availability 203485
Bit rate 203485
Camera maker 203485
Camera model 203485
Categories 203485
Category 1
Collection 1
Comments 203485
Company 203485
Conductors 203485
Contributing artists 203485
Copyright 203485
Creation Date 1
Date accessed 203485
Date created 203486
Date Deleted 1
Date modified 203488
Date taken 203485
Designed for 1
Designer/foundry 1
Dimensions 203485
Family 1
File description 203485
Folder path 2
Font embeddability 1
Font file names 1
Font style 1
Font type 1
Font version 1
Genre 203485
Item type 203487
Kind 203485
Last Accessed 1
Last Synchronization 1
Length 203485
Location 1
Masters keywords 406974
Name 203489
Offline status 203485
Original Location 1
Owner 203485
Perceived type 203485
Program File 1
Protected 203485
Rating 203485
Show/hide 1
Size 203489
Status 2
Subject 203485
Tags 203487
Time Period 1
Title 203485
Total Size 1
Version 1
Year 203485