Search code examples
filewinapiuwpwindows-runtimewindows-shell

Can we use the Cloud Storage API for typed custom properties?


Using the Cloud Files API environment, is it possible to define typed custom properties? The only method I can find is Windows.Storage.Provider.StorageProviderItemProperties.SetAsync(). This takes a list of StorageProviderItemProperty whose Value is string.

However, custom properties defined with the Property Description Schema can have types and offer a lot more control.

For instance, "file size" and "dates" get special treatment in the column headers.

Column header popup for date Column header popup for filesize


Solution

  • One can define custom Windows Properties and register them using the PSRegisterPropertySchema function. Note registration and unregistration needs admin right so is usually done at install/uninstall time.

    The "special treatment" you see is defined in the schema.

    Now, adding these properties in a a Shell View is only possible per file type as stated here: Initializing Property Handlers / Before you begin

    Property handlers are always associated with specific file types; thus, if your file format contains properties that require a custom property handler, you should always register a unique file name extension for each file format.

    For cloud based placeholder files, you can register a custom property handler with the package itself using the desktop3:ExtendedPropertyHandler Xml element in the manifest.