i'm making 2 UWP apps, and i want to make them share 1 DB.
i'm using Microsoft.Data.SQLite
however, is there any way to share the same DB??
SqliteConnection db = new SqliteConnection("Filename=data.db"));
"Filename=data.db" path was c:\Users(user
name)\AppData\Local\Packages(App ID)\LocalState\data.db
However, I know UWP app can only access that c:\Users\ (username)\AppData\Local\Packages(App ID)\LocalState\ folder except shared app data folders.
So, can you tell me how to direct the shared app data folder to Connection String?
Are two ways to that:
1) Creates a button to call user action to select the common folder using a Picker to file or folder. Your application stores the access token returned by this explicit authorization and use that in future with no new user interaction.
2) Have a few ways to app get store authorization, but some that needs an enterprise Windows Store association (like Documents Library). I not sure, but for some locations, in the app validation you will be required to justify the needs before to publish your app.
More details in here: https://learn.microsoft.com/en-us/windows/uwp/files/file-access-permissions. See the title "Accessing additional locations".
Related
I'm new in Xamarin.Forms and mobile development. I want to store user and encrypted password of my application user in file on mobile device. I'm using xamarin forms technology. I kwnow that there are many differenet folders. In example:
System.Environment.SpecialFolder.Personal
System.Environment.SpecialFolder.LocalApplicationData
System.Environment.SpecialFolder.MyDocuments
Full list you can find here: https://msdn.microsoft.com/en-gb/en-enl/library/system.environment.specialfolder(v=vs.110).aspx
What is the best folder / catalog for store:
user and password data
other application specyfic data
??
Edit: I have found that "Personal" is good for me, but if you have other answers post it as well. SpecialFolder.Personal location
Storing small Key-Value Pairs:
Xamarin.Forms implements Application.Current.Properties which stores the key value data in the local storage of the app and access to these key-value pairs are secure to that app only who stored them.
Storing Documents/Database (Sqlite):
Each platform has it's own folder structure to store app specific data/files underneath.
Android:
Environment.SpecialFolder.Personal & MyDocuments both maps to: /data/data/#PACKAGE_NAME#/files
Environment.SpecialFolder.LocalApplicationData maps to: /data/data/#PACKAGE_NAME#/files/.local/share
We can store files in any of the above directories based on how they are mapped in the file system.
None of the above directories can be accessed by other app, nor user can access them outside the world unless the phone is rooted.
iOS:
Environment.SpecialFolder.Personal, LocalApplicationData & MyDocuments all map to: /Documents
iOS has following directory structure:
/Documents
/Library
/Library/Application Support
/Library/Caches
/tmp
/Documents: Gets visible in iTunes If iTunes sharing is turned on in info.plist in the app. Content can be backed up by iTunes/iCloud.
/Library: Not visible in iTunes. Can be backed up by iTunes/iCloud except Caches directory.
Files/Data which doesn't need to expose to user should be stored in Library directory. Ex. database files. I would go for Library directory for add on security along with encryption (if required).
To get to the Library Path:
Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "..", "Library");
To know more on each Enumeration's mapping with directory Go Here.
Find basics about iOS File System Basics.
I've deployed a website into Azure and i want to access programaticaly this path : "D:\home\site\app" from a c# desktop application and delete all files and upload new ones programatically.
i have searched and found many ways but all are for AzureStorage or using Kudu consol or FTP while what i realy want is to access the local storage where the website is deployed programatiacally, and make some edits on files programatically.
Sure thing, the Site Control Manager (Kudu) has an API for that, the VFS API:
https://github.com/projectkudu/kudu/wiki/REST-API#vfs
You can use either of these for authentication:
A Bearer token that you obtain from the STS (reference implementation in ARMClient)
Site-level credentials (the long ugly ones under your Web App → Properties)
Git/FTP credentials (subscription level)
Sample usage (using site-level credentials):
# Line breaks brutally used to improve readability
# /api/vfs/ is d:\home
# Append path as necessary, i.e. /api/vfs/site/app
$ curl -k https://$are-we-eating-too-much-garlic-as-a-people:6sujXXX
XXXXXXq7Zc#are-we-eating-too-much-garlic-as-a-people.scm.azurewebsites.net
/api/vfs/site/wwwroot/ill-grab-this-file-over-vfs-api.txt
There, i did it.
I'm assuming here that you want to do all that from the outside world - since you don't clearly state otherwise.
Well, in my azure code. my task was to save a excel file and upload its contents to SQL server.
I used this plain and simple to access home site.
string fileToSave = string.Format("{0}\\{1}", HostingEnvironment.MapPath(#"~\Temp"), FileUpload.FileName);
if (!Directory.Exists(HostingEnvironment.MapPath(#"~\Temp")))
Directory.CreateDirectory(HostingEnvironment.MapPath(#"~\Temp"));
FileUpload.PostedFile.SaveAs(fileToSave);
you could use something like this to delete and save a new file or other I/O operations.
My UWP app needs to share some xml files between different users.
Let's say user A creates the files, and user B needs to access them (read and write).
The files are saved by user A to the App folder on her OneDrive (OneDrive > Apps > MyApp > file.xml).
Now when user B is using the app, he needs to access the files on A's OneDrive.
As far as I can tell, using the C# OneDrive SDK I have two ways to have B access the files:
1) User A shares the MyApp folder with user B, and sends him the folder id. User B enters the folder id in the app and the app can get to the files using the folder id.
2) User A shared the MyApp folder with user B; user B adds the shared folder to his OneDrive; now the app can search for the folder by looking through the children of Drive/Root and finding a folder that has the right name and has a remote item. The app can get to the files using the remote item id.
I don't really like either solution because both of them rely on work by the user that is error prone and likely not something that they have had to do before (sending a weird id in an email, entering it in the app, or adding the shared folder to one's OneDrive).
Ideally I would have user A share the folder with B and then the app would somehow find it through B's OneDrive (without B explicitly adding it) but I haven't found a way to do that with the C# SDK.
For whoever has the same problem:
As it turns out, it should be possible to find folders shared with the user through the API, but it doesn't work because of this bug: https://github.com/OneDrive/onedrive-sdk-csharp/issues/133
There is a fix for the bug that applies only to version 1.2 of the API amd it can be found in this branch: https://github.com/OneDrive/onedrive-sdk-csharp/tree/v1-maintenance
I am making a windows phone application, and have divided my solution up in 4 projects.
WebService
MainProject
SecondaryProject
PortableLibrary
I share models between all projects using the Portable Library. But how to share information, I know I can share variables and other elements using Uri Scheme:
NavigationService.Navigate(new Uri("/Project;component/URI.xaml", UriKind.Relative));
But what if I want to parse Complex objects?
An Example with pseudo code and program flow:
**STARTUP->MainProject**
UILoad(); //Login UI shown
MobileService.Authenticate(); //Authentication stored in Isolated storage through CreditVault.
NavigateTo->MainMenu(); //
**MainMenu->SecondaryProject**
NavigationService.Navigate(new Uri("/SecondaryProject;component/URI.xaml", UriKind.Relative));
MobileService.AccessRestrictedInformation(); //How to still be authenticated here?
SavePictureAndInformation(); //How to make Information available to all projects in the solution?
The authentication I have on the startupPage, allows me to automatically re-authenticate users, which is why I store it encrypted.
Questions
Can the other Project access the IsolatedStorage of the first project, if so how?
If I authenticate the user upon startup, will a created mobileservice in another project within the solution also be authenticated?
Am I missing somethine smart?
External Information
I need the setup of multiple projects with pages and cannot insert them in the same project. So it is not a solution to have it in the same project.
You can share information between projects using IsolatedStorage or use the application.current.resources, from this link http://mikaelkoskinen.net/windows-phone-pass-data-between-pages-application-resources/
Hope somebody find it useful :)
I am a beginner in QuickBook. I have created a .NET application and is able to connect to a QuickBooks Api based app from my application. I have managed to show Blue Dot Menu in my application.
Now I have a requirement to attach to company file.
1 - I would like what this company file is all about and what does it contain ?
2 - How are they created and managed ?
3 - How can I attach or access these files using .NET application ?
Thanks in advance.
At first, you can read the common QB terminologies.
https://developer.intuit.com/docs/0025_quickbooksapi/0070_glossary
Development related docs are available here -
https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started
Using ApiExplorer, you can test all endpoint.
Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0007_firstrequest
You can try the sample .net
https://github.com/IntuitDeveloperRelations/IPP_Sample_Code/tree/master/QuickbooksAPI/DotNet
.net devkit - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0100_ipp_.net_devkit
1 - I would like what this company file is all about and what does it contain ?
Company file contains data. Your QBD's data get saved in company file(locally). Comapny file's data gets uploaded to cloud when you sync it. After sync, you get an id(called 'relamId' corresponding to your company file). While calling API endpoints, you use that relamId as a dataSource.
For QBO, all data gets saved in cloud.
2 - How are they created and managed ?
End-users(company file owners) manage their company files.
3 - How can I attach or access these files using .NET application ?
In the sample app's web.config, you need to set consumer key, consumer secret and app tokens. Your app's user will go through the OAuth flow to connect their QB account's data(available in cloud) with your app. Your app should use that consumer key, consumer secret, apptoken and releamId to get access token and access secret. Using these tokens, your app will be able to communicate with end-user's data-file.
Hope these info will be useful.
Thanks