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