11598

Sharing data files between users in a Universal Windows Platform application

Question:

I am about to embark on the development of a line of business application using the Universal Windows Platform (Windows 10). One of the requirements of the application is the synchronisation of data from a server to a local SQLite database; this is required because the application needs to be usable where there is no network connectivity.

It is likely that multiple (windows domain) users will be accessing the application on the same device, sometimes simply by "swapping users", other times by logging off the first user and logging on as a new user.

I realise that UWP applications are installed at a user level, however I would like to be able to share the SQLite database between these users instead of forcing each user to download their own copy of the data.

Is this possible? I am struggling to find any reference to this kind of sharing within the <a href="https://msdn.microsoft.com/library/windows/apps/dn894631.aspx" rel="nofollow">Microsoft documentation</a> - but of course that documentation is new and far from complete!

I guess at the end of the day I am looking for access to a folder that is accessible by any user running that application on the same device, such as the "<em>x</em>:\Users\Public" folders that are available from the desktop, but without having to ask the user to provide access to that folder via any picker control - instead simply being able to "open" it.

Thanks.

Answer1:

In case anyone runs across this, this functionality is now available as described in this <a href="https://blogs.windows.com/buildingapps/2016/05/24/sharing-your-local-app-data/" rel="nofollow">blog post</a>:

<blockquote>

We introduced a new storage location Windows 10, ApplicationData.SharedLocalFolder, that allows multiple users of one app to share local data. Obviously this feature is only interesting with devices that will be used by more than one person. For such scenarios, for example in educational uses, it may make sense to place any large downloads in Shared Local. The benefits will be two-fold: any user can access these files without the need to re-download them, also there will be storage space savings

Keep in mind that Shared Local is only available if the machine has the right group policy, otherwise when you call ApplicationData.Current.SharedLocalFolder you will get back a null result.

In order to enable Shared Local the machine administrator should enable the corresponding policy.

<a href="https://i.stack.imgur.com/aFZtr.png" rel="nofollow"><img alt="Group Policy Change" class="b-lazy" data-src="https://i.stack.imgur.com/aFZtr.png" data-original="https://i.stack.imgur.com/aFZtr.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Alternatively, the administrator could create a REG_DWORD value called AllowSharedLocalAppData with a value of 1 under HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\AppModel\StateManager

<a href="https://i.stack.imgur.com/dGkFu.png" rel="nofollow"><img alt="Registry Change" class="b-lazy" data-src="https://i.stack.imgur.com/dGkFu.png" data-original="https://i.stack.imgur.com/dGkFu.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Note that data store in ShareLocal will only be persisted as long as the app is installed on the device and won’t be backed up by the system.

</blockquote>

Answer2:

In Solution Explorer , Right click on <strong>Package.appxmanifest</strong> then click on ViewCode , end of this file in both projects add below code :

<Extensions> <Extension Category="windows.publisherCacheFolders"> <PublisherCacheFolders> <Folder Name="FolderName" /> </PublisherCacheFolders> </Extension> </Extensions>

After that in code you can access this folder with below line of code :

StorageFolder sharedDownloadsFolder = ApplicationData.Current.GetPublisherCacheFolder("FolderName");

It`s so important that the folder you will share between two these Apps depend on same publisher info at Certificate File <strong>[ProjectName]_TemporaryKey.pfx</strong> , if this Certificate File and publisher Info of app is same in both Projects , then you can access the same <strong>SharedFolder</strong> in both application and use it for create or use dataBase file(like SQLite Database file) or other files that need to be share in both applications.

Recommend

  • Unable to load dynamic library 'oci8.so' (PHP 7.2)
  • ActiveRecord oracle_enhanced adapter can't load ruby-oci8 library
  • JQuery Validation for Duplicates in Form Array
  • How to import lldb in a python script
  • Scrapy and submitting a javascript form
  • Enumerating attached DVD drives in Linux / Java / Scala
  • WPF: Run Validator on two comboboxes as the same time
  • How to really enable php-fpm with apache?
  • Copying contents of a file to another using read(), write(), open()
  • Angular Material mat-table is not showing updated data from data source
  • Select running balance from table credit debit columns
  • How to get delivery report for a specific contact number while sending sms to multiple contacts in a
  • C++ method declaration including a macro
  • What is need of Assign/Deassign in Verilog?
  • XtraGrid - Export To Excel
  • CABasicAnimation creates empty default value copy of CALayer
  • Spongycastle is missing many algorithms when loaded on android
  • SpringBoot don't replacen System variable {user.home} in Spring Tool Suite Version: 3.8.4.RELEA
  • Get name of days between two date in ios?
  • VBScript InputBox and Help Files
  • Does hibernate load two seprate copies of same instance if they are loaded twice from database?
  • Facebook Error (#200) The user hasn't authorized the application to perform this action (PHP)
  • Request Access Token in Postman for Azure Function App protected by Azure AD B2C
  • How to resolve this in PHPUnit where it is asking me to set KERNEL_DIR in my phpunit.xml?
  • Wireshark Display Filter for Unique Source/Destination IP and Protocol
  • time column in sqlite using gorm
  • When to use the tag in the head and body section of a html page? [duplicate]
  • How to run chrome.tabs.insertCSS from the background page on each page?
  • Neo4j…how to get a visual representation of my data?
  • Support of :after in IE7
  • Python 3x- Compression Makes File Bigger :(
  • DataTables move rows between tables
  • Cloud Code: Creating a Parse.File from URL
  • how to run ejabberd with Erlang on Heroku?
  • Will this work on all screen sizes?
  • Codeigniniter insert data through models and controller
  • Python Flask - GUI for client
  • Jersey serializes character value to ASCII equivalent numeric string
  • Spring Boot not autowiring @Repository
  • ARKit code issue {unknown error -1=ffffffffffffffff error: Task failed with exit 1}