UWP: Is it possible to create your own network files (similar to Onedrive)?

Viewed 249

I was looking at the documentation for Determining availability of Microsoft OneDrive files and I was wondering whether is possible to create these kind of files yourself. In other words, is it possible to create network files that can be automatically downloaded or synced by your application, or is this feature reserved for OneDrive?

I couldn't find anything about this myself and I'm assuming the latter, but I was hoping others could provide more insight on this topic.

1 Answers

Since Windows 10 Creators Update Microsoft provides Cloud Sync Engine / Cloud Filter API. It supports all features that OneDrive has: download (hydration), synchronization, offline mode, and commands in Win File Manager. Some API is available via .NET, but most are Win32 API.

Here are examples on GitHub:

Cloud Filter API provides several modes, some of which are not for OneDrive-like disk. Here some general principles, so you do not need to test and understand all modes:

  1. Create your storage using StorageProviderSyncRootInfo with PopulationPolicy set to StorageProviderPopulationPolicy.Full. Then your callbacks will be called when an application is trying to list folder content or read file content.

  2. During the first folder listing create placeholders inside CF_CALLBACK_TYPE_FETCH_PLACEHOLDERS. Disable on-demand population when the initial folder listing is completed. Do NOT update placeholders inside this callback. It looks like it is designed for initial placeholder creation only.

  3. When any file/folder is created/updated/deleted/moved/renamed on the server, notify the client via web sockets or other technology (push) and update client placeholders accordingly. Alternatively you can pull the server or implement other sync algorithms.

Related