title: UWP save file in Documents and Pictures Library
body: <p>I'm trying to make a UWP app which can export a file saved in his own storage into the document library.</p>
  
  <p>In Package.appxmanifest I've inserted the following lines:</p>
  
  <pre><code>&lt;uap:Capability Name="picturesLibrary" /&gt;
  &lt;uap:Capability Name="documentsLibrary" /&gt;
  </code></pre>
  
  <p>The code to get the path is this:</p>
  
  <pre><code>StorageFolder storageFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.DocumentsLibrary);            
  string path = storageFolder.Path + "\\" + fileName; 
  </code></pre>
  
  <p>The code to save the file is this:</p>
  
  <pre><code>FileStream writer = new FileStream(filePath, FileMode.Create);
  </code></pre>
  
  <p>At this point, the program launches this exception:</p>
  
  <pre><code>Access to the path 'C:\Users\luca9\AppData\Roaming\Microsoft\Windows\Libraries\Documents.library-ms' is denied.
  </code></pre>
  
  <p>On my 950XL, the exception is similar:</p>
  
  <pre><code>Access to the path 'C:\Data\Users\DefApps\APPDATA\ROAMING\MICROSOFT\WINDOWS\Libraries\Documents.library-ms' is denied.
  </code></pre>
  
  <p>I've tryied both on Documents and Pictures libraries, but I get the same exception.</p>
  
  <p>How can I solve it?</p>
  
  <p>Thank you in advance,</p>
  
  <p>Luca</p>