Sharing data between users of a Universal App


  • Users of a Universal App can share data between them on the same physical machine.
  • With a proper synchronization mechanism, this method could also be used to communicate with a regular desktop app.
  • This feature is disabled by default and ApplicationData.Current.SharedLocalFolder will always return "null".
  •  

    How to use:

    • Enable the policy e.g. by creating a REG_DWORD value called AllowSharedLocalAppData under HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\AppModel\StateManager and set it to 1.
    • You can now run code similar to the following to access a shared file:
    Storage folder = ApplicationData.Current.SharedLocalFolder;
    
    StorageFile file = await folder.CreateFileAsync("Test.txt");
    
    await FileIO.WriteTextAsync(file, "Hello world!");
    
    • This code will create a file called Test.txt under C:\ProgramData\Microsoft\Windows\AppRepository\Families\<PACKAGE NAME>\SharedLocal\.
Comments (0)

Skip to main content