title: Zip all files in a folder
body: <p>I'm a bit new to WinRT developing platform, and it's already driving me crazy (I'm a long-time .Net developer, and all those removed APIs are quite annoying)
  I'm experiencing a problem while zipping all files present in the Windows.Storage.ApplicationData.Current.TemporaryFolder
  Here is my current code (VB.Net, based on MSDN code, and "file" is the zip file I'll put all my files into) :</p>
  
  <pre><code>Using zipMemoryStream As New MemoryStream()
  Using zipArchive As New Compression.ZipArchive(zipMemoryStream, Compression.ZipArchiveMode.Create)
      For Each fileToCompress As Windows.Storage.StorageFile In (Await Windows.Storage.ApplicationData.Current.TemporaryFolder.GetFilesAsync())
          Dim buffer As Byte() = WindowsRuntimeBufferExtensions.ToArray(Await Windows.Storage.FileIO.ReadBufferAsync(fileToCompress))
          Dim entry As ZipArchiveEntry = zipArchive.CreateEntry(fileToCompress.Name)
          Using entryStream As Stream = entry.Open()
              Await entryStream.WriteAsync(buffer, 0, buffer.Length)
          End Using
      Next
  End Using
  Using zipStream As Windows.Storage.Streams.IRandomAccessStream = Await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite)
      Using outstream As Stream = zipStream.AsStreamForWrite()
          Dim buffer As Byte() = zipMemoryStream.ToArray()
          outstream.Write(buffer, 0, buffer.Length)
          outstream.Flush()
      End Using
  End Using
  End Using
  </code></pre>
  
  <p>It builds well, but when I launch the code, I have the exception :
  UnauthorizedAccessException : Access denied. (Exception de HRESULT : 0x80070005 (E_ACCESSDENIED))
  On line : WindowsRuntimeBufferExtensions.ToArray(blahblah...
  I'm wondering what is wrong. Any idea ?</p>
  
  <p>Thanks in advance !</p>