如何避免在Windows File Manager根目录中显示存储提供程序同步根目录 [英] How to avoid displaying a storage provider sync root in Windows File Manager root

查看:98
本文介绍了如何避免在Windows File Manager根目录中显示存储提供程序同步根目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用存储提供程序和Windows Cloud Files API创建文件系统.我想避免在Windows文件管理器中显示同步根目录:

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:

这是我用来注册同步根目录的代码:

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);

可以在此 GitHub存储库中找到完整的代码.

A complete code could be found in this GitHub repository.

如何使我的文件系统不在Windows文件管理器的根目录下显示?

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

推荐答案

根据

According to Integrate a Cloud Storage Provider article you can edit your Sync Root registration info and modify HKCU\Software\Classes\CLSID\{<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.

要找到SyncRoot CLSID,您需要打开同步根注册管理器并找到您的注册条目: HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ SyncRootManager \<您的同步根> \ NamespaceCLSID

To find you SyncRoot CLSID you need to open sync root registration manager and locate your registration entry: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager\<your sync root>\ NamespaceCLSID

这篇关于如何避免在Windows File Manager根目录中显示存储提供程序同步根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆