Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Followers 0
Login Register as User

C# UWP Sample: Open File with GlobalFile Access BraodFileSystemAccess

19.06.2018 (👁12928)

Example Application UWP with free file access via Capability broadFileSystemAccess  


In May 2018, Microsoft finally expanded the development platform UWP Universal Windows Platform.

Starting with the 1803 version, the BroadFileSystemAccess settings can be used to access the files of the current user.

That is, the application can easily access files in the C path or data path without additional user interaction.

Previously, a manual file dialog or folder dialog had to be opened for approval.


Example application:

Copy a file to free directory and path specification



In this example, the default page simply contains a button and any two text boxes with the path of a file










    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">



        <Button x:Name="btnCopy" Content="Copy" HorizontalAlignment="Left" Height="99" Margin="94,140,0,0"

                VerticalAlignment="Top" Width="257" Click="btnCopy_Click"/>

        <TextBox x:Name="tbxFolder" HorizontalAlignment="Left" Height="84" Margin="88,276,0,0" Text="C:\_Daten\_temp\UWP_unknown" VerticalAlignment="Top" Width="603" FontSize="22"/>

        <TextBox x:Name="tbxFile" HorizontalAlignment="Left" Height="84" Margin="91,380,0,0" Text="Testfile.log" VerticalAlignment="Top" Width="603" FontSize="22"/>




In C # code, the path is read from the text fields. From this the StorageFolder is created and from this the file is opened and copied as StorageFile.

Attention: for this purpose the setting with Capability Name = "broadFileSystemAccess is necessary. Because in this UWP app, the file is simply opened without additional user interaction.

So no manual file sharing dialog will be necessary!

        private async void  btnCopy_Click(object sender, RoutedEventArgs e)


            StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(tbxFolder.Text);

            StorageFile file = await folder.GetFileAsync(tbxFile.Text);

            StorageFile copyFile = await file.CopyAsync(folder, "Copied_File.txt", NameCollisionOption.ReplaceExisting);




In the package.appxmanifest file you have to complete the Package.IgnoreableNamespaces and add the capabilities


<Package ..


         IgnorableNamespaces="uap mp rescap">




    <rescap:Capability Name="broadFileSystemAccess" />





<?xml version="1.0" encoding="utf-8"?>

<Package xmlns=""




         IgnorableNamespaces="uap mp rescap">

  <Identity Name="c76c1dbf-c893-4f40-8f82-0934dfd31490" Publisher="CN=Raimund" Version="" />

  <mp:PhoneIdentity PhoneProductId="c76c1dbf-c893-4f40-8f82-0934dfd31490" PhonePublisherId="00000000-0000-0000-0000-000000000000" />







    <TargetDeviceFamily Name="Windows.Universal" MinVersion="" MaxVersionTested="" />



    <Resource Language="x-generate" />



    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="test_file_open.App">

      <uap:VisualElements DisplayName="test_file_open" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="test_file_open" BackgroundColor="transparent">

        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">


        <uap:SplashScreen Image="Assets\SplashScreen.png" />






    <Capability Name="internetClient" />

    <uap:Capability Name="picturesLibrary" />

    <rescap:Capability Name="broadFileSystemAccess" />




Project minimum version

Necessary for this is the version 1803 in the UWP settings

Project-> Properties-> Application


Target: Universal Windows

Target Version: Windows 10, version 1803 (10.0; Build 17134)