This project has moved. For the latest updates, please go here.

File Types - Not Found In List

Jan 7, 2014 at 4:42 PM
Software works as expected - but was looking to add tags to the following file types and was not able to locate them in the File Meta Association Manager list of file extensions. Any chance these file types can be associated with the File Meta Property Handler?

EPS
OUT
sas
sas7bcat
sas7bdat
sd2
xpt

Thanks
Coordinator
Jan 8, 2014 at 10:54 AM
Yes, with a little tweaking.

Windows Explorer knows how to deal with a file extension based on its registry entry. These are set up either by default as part of Windows setup, or when some software that edits files with the extension is installed.

The File Meta Association Manager simply reads all the file extension registry entries and displays them, so the fact that the extensions you want are not showing up implies that they don't exist in the registry.

It is therefore necessary to either install some software that handles files with that extension, or create the entry manually. Happily, the entry you need is as minimal as it gets, so manual creation using regedit is a breeze. All you have to have is a key under HKEY_CLASSES_ROOT whose name is the extension preceded by a dot. It does not need to have any values at all. For instance, the entry for the OUT extension would be:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.OUT]

That's it. Once this entry exists in the registry, the extension will show up in the File Meta Association Manager (when you restart it) and you can add the File Meta Property Handler to it and start editing metadata. Note that you may need to kill all instances of explorer.exe and restart it before you can save values successfully.

Dijji
Jan 13, 2014 at 7:12 PM
Thanks for the info, that worked. You appear to have a ton of knowledge in this area - I have a question about updating the extended property value for the TAGS property using PowerShell, VB or C++. I have done some searching but have not come across any commands that might work. I am able to view the extended properties for each file using "getDetailsof" command but I am really interested in finding out how to update (programmatically) the TAGS property for about 500,000 files located in 100,000 folders on an NTFS file system without having to use the Windows Explorer interface. Do you know if this can be done and if so what command and language would work best?

Greg

iginal Message -----
From: Dijji
To: [email removed]
Sent: Wed, 08 Jan 2014 10:54:16 -0000 (UTC)
Subject: Re: File Types - Not Found In List [filemeta:483968]

From: Dijji

Yes, with a little tweaking.







Windows Explorer knows how to deal with a file extension based on its registry entry. These are set up either by default as part of Windows setup, or when some software that edits files with the extension is installed.







The File Meta Association Manager simply reads all the file extension registry entries and displays them, so the fact that the extensions you want are not showing up implies that they don't exist in the registry.







It is therefore necessary to either install some software that handles files with that extension, or create the entry manually. Happily, the entry you need is as minimal as it gets, so manual creation using regedit is a breeze. All you have to have is a key under HKEY_CLASSES_ROOT whose name is the extension preceded by a dot. It does not need to have any values at all. For instance, the entry for the OUT extension would be:







Windows Registry Editor Version 5.00




[HKEY_CLASSES_ROOT\.OUT]







That's it. Once this entry exists in the registry, the extension will show up in the File Meta Association Manager (when you restart it) and you can add the File Meta Property Handler to it and start editing metadata. Note that you may need to kill all instances of explorer.exe and restart it before you can save values successfully.







Dijji


Coordinator
Jan 13, 2014 at 9:12 PM
Yes, it is possible.

The important thing is to hook into the property system in the same way that Windows Explorer does. This ensures that you pick up any Property Handler that is installed for an extension, whether it is one of those that comes with Windows, e.g. for Office Documents or JPEG’s, or the File Meta Property Handler, or one installed by third party software.

At the Windows API level, the C++ code needed looks something like this:
IShellItem2Ptr pShellItem2;
hr = SHCreateItemFromParsingName(L“full path”, NULL, IID_PPV_ARGS(&pShellItem2));

if (SUCCEEDED(hr))
{
    PROPVARIANT pv;
    PropVariantInit(&pv);
            
    hr = pShellItem2->GetProperty(PKEY_Keywords, &pv);
}
Happily, Microsoft have taken this and a lot more and wrapped it up for use from .Net languages like VB, in the form of the Windows API code pack, downloadable from http://archive.msdn.microsoft.com/WindowsAPICodePack

Even better, a sample called PropertyEdit is included which supports command lines like the following:
PropertyEdit.exe  -get System.Keywords test.jpg
PropertyEdit.exe  -set System.Keywords “tag1;tag2” test.txt
Note that System.Keywords is the official name of the tags property.

So, I think, if you download the Windows API code pack, the source for the PropertyEdit sample will show you how to do it from VB, or if you compile it, you will have something usable from PowerShell. Or, if you're feeling hard core, there's always C++ and the Windows API.

Dijji
Jan 16, 2014 at 3:59 PM

I finally got around to testing out the API code pack. It appears that PropertyEdit.EXE only works for Windows supported file types and not the custom ones that I had setup using the File Association Manager. I am able to view and update the System.Keywords for Word documents and Image file types supported by Windows 7, but when trying to view System.Keywords for custom file types the code returns Null values and when I try to "Set" a new value for custom file types the code returns an error:

==============================================
WORKS FOR FILETYPES FOUND IN THE PropertyStore
==============================================
C:>PropertyEdit.exe -get System.Keywords testit.docx"
System.Keywords = TestTag2

C:>PropertyEdit.exe -set System.Keywords "TestTag3" testit.docx
Property System.Keywords value TestTag3 written successfully

C:>PropertyEdit.exe -get System.Keywords testit.docx"
System.Keywords = TestTag3

=====================================================
DOES NOT WORK IF FILETYPE IS NOT IN THE PropertyStore
(there is a tag assigned to the "test2.txt" file)
The -get command does not display the tag... or
allow one to be assigned using the -set command
=====================================================
C:>PropertyEdit.exe -get System.Keywords test2.txt
System.Keywords =

C:>PropertyEdit.exe -set System.Keywords "TestTag1" test2.txt
Error 80004005: getting the propertystore for the item.


The PropertyEdit code calls GetPropertyStore which does not include the custom file types. I am not sure if it would be possible to create a custom property store that would include the custom file types... or if there is any other way of updating the tags for a custom file type?

Regards

Coordinator
Jan 16, 2014 at 4:25 PM
Now we have a mystery. With the File Meta Property Handler registered for .txt using the Association Manager, I get:
C:\Testtags>"C:\targets\Windows API Code Pack 1.1\source\Samples\Shell\PropertyEditDemo\CS\PropertyEdit\bin\Debug\PropertyEdit.exe" -get "System.Keywords" t2.txt
System.Keywords = ta1; ta2

C:\Testtags>"C:\targets\Windows API Code Pack 1.1\source\Samples\Shell\PropertyEditDemo\CS\PropertyEdit\bin\Debug\PropertyEdit.exe" -set "System.Keywords" "tc;d" t2.txt

C:\Testtags>"C:\targets\Windows API Code Pack 1.1\source\Samples\Shell\PropertyEditDemo\CS\PropertyEdit\bin\Debug\PropertyEdit.exe" -get "System.Keywords" t2.txt
System.Keywords = tc; d
What might be different?

Dijji
Jan 17, 2014 at 9:39 PM
Downloaded API code pack again and reloaded - works as you described (obvious operator error...)

THANKS