Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

filter - How to avoid displaying a storage provider sync root in Windows File Manager root

I am creating a file system using a storage provider and Windows Cloud Files API. I want to avoid displaying a sync root in Windows File Manager:

enter image description here

Here the code that I use to register sync root:

        string path = "C:\Users\User1\DAV\";
        StorageProviderSyncRootInfo storageInfo = new StorageProviderSyncRootInfo();
        storageInfo.Path = await StorageFolder.GetFolderFromPathAsync(path);
        storageInfo.Id = syncRootId;
        storageInfo.DisplayNameResource = "WebDAV Drive";
        storageInfo.IconResource = "C:\Drive.ico";
        storageInfo.Version = "1.0"
        storageInfo.RecycleBinUri = new Uri("https://userfilesystem.com/recyclebin");
        storageInfo.Context = CryptographicBuffer.ConvertStringToBinary(path, BinaryStringEncoding.Utf8);

        storageInfo.HydrationPolicy = StorageProviderHydrationPolicy.Progressive;
        storageInfo.HydrationPolicyModifier = StorageProviderHydrationPolicyModifier.AutoDehydrationAllowed | StorageProviderHydrationPolicyModifier.ValidationRequired;

        storageInfo.PopulationPolicy = StorageProviderPopulationPolicy.Full;

        storageInfo.InSyncPolicy =
            StorageProviderInSyncPolicy.FileCreationTime    | StorageProviderInSyncPolicy.DirectoryCreationTime |
            StorageProviderInSyncPolicy.FileLastWriteTime   | StorageProviderInSyncPolicy.DirectoryLastWriteTime |
            StorageProviderInSyncPolicy.FileHiddenAttribute | StorageProviderInSyncPolicy.DirectoryHiddenAttribute |
            StorageProviderInSyncPolicy.FileSystemAttribute | StorageProviderInSyncPolicy.DirectorySystemAttribute;
        
        StorageProviderSyncRootManager.Register(storageInfo);

A complete code could be found in this GitHub repository.

How do I make my file system not show up at the root level in Windows File Manager?

question from:https://stackoverflow.com/questions/65931870/how-to-avoid-displaying-a-storage-provider-sync-root-in-windows-file-manager-roo

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

According to Integrate a Cloud Storage Provider article you can edit your Sync Root registration info and modify HKCUSoftwareClassesCLSID{<GUID>} System.IsPinnedToNameSpaceTree value to be 0. This will hide your sync root folder from explorer tree. User will still be able to see it if he turns on "Show all folders" option.

To find you SyncRoot CLSID you need to open sync root registration manager and locate your registration entry: HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorerSyncRootManager<your sync root> NamespaceCLSID


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...