0

I am using the Cloud File Api to write a custom OneDrive-like sync client. I have a desire to have custom properties that are available in explorer.

When I register my CFAPI SyncRoot during installation, I can define custom properties as follows.

        var initialPropDefinitions = syncRootInfo.StorageProviderItemPropertyDefinitions;
        var customPropDefinitions = propertyManager.GetCustomPropertyDefinitions();
        foreach (var propDef in customPropDefinitions)
        {
            var osPropDef = new StorageProviderItemPropertyDefinition
            {
                DisplayNameResource = propDef.DisplayNameResource,
                Id = propDef.Id
            };
            initialPropDefinitions.Add(osPropDef);
        }

        _storageProvider.RegisterSyncRoot(syncRootInfo);

This works great. The properties I assign are available in windows explorer to add as columns.

My problem comes when I try to set the property values. Below is the code that I use to assign property values.

List<StorageProviderItemProperty> itemProperties = new List<StorageProviderItemProperty>();
customColumns.Add(new StorageProviderItemProperty() {
    Id=3,
    Value="Hello"
    IconResource = string.empty
};

await StorageProviderItemProperties.SetAsync(item, itemProperties);

This works well but, Explorer crashes whenever I use an empty IconResource. I can fix this by creating a blank icon. So I had an example where I have 3 properties, one actually has an icon and the other two are blank. The status column shows all of the icons and you can see that the blank icons are taking up real estate under the status column. Sure, I can arrange my properties so that all of the ones that have real icons are set first. But, I would really like a way to set property values without using an icon. Is there such a way?

enter image description here

7
  • Does it make a difference if you set the icon resource to "" rather than string.empty? Commented Aug 2, 2024 at 13:07
  • @IInspectable, In my experience it doesn't make a difference. I get the same behavior in both cases which is explorer crashing during navigation. Commented Aug 2, 2024 at 13:31
  • I do reproduce the crash with an empty string (it's the same with the C++ CloudMirror sample if you pass L"" here github.com/microsoft/Windows-classic-samples/blob/main/Samples/…). That smells like a Shell bug. For the rest, I'm not sure it's expected. Only Microsoft can confirm/infirm that. Commented Aug 2, 2024 at 15:03
  • @SimonMourier thank you. In your opinion, Is this property feature just intended for icon extension or, is it intended for custom properties? If I implemented 10-20 custom properties, would I be abusing the system? Commented Aug 5, 2024 at 14:49
  • My opinion is, if the icon is mandatory for which only Microsoft can really say at 100%, this thing is for handling custom "statuses" (ie: replace the "15-max overlays" broken design read this down to the end devblogs.microsoft.com/oldnewthing/20190313-00/?p=101094), not really "extended" properties backed by PROPERTYKEYs (which can have icons too although it's not strictly documented). Also this column (these icons) are the only ones which are shown in all Shell Views mode (details, icon, large icon, content, etc.) Commented Aug 5, 2024 at 15:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.