title: What is a way to open file for writing wihout having to use OpenFilePicker in WinRT, Win8
body: <p>I've been at this for a few days and been fighting with this for two years.  Roughly, I have an App where the user opens a file, edits for a long period of time and then saves or suspends until later.  I have an automatic save feature that works, but, I want an auto-archiving feature too (in case the user wants to auto-save to a backup file, and not overwrite the current file).</p>
  
  <p>Roughly speaking, I want to create a new file when a file is being edited, hopefully where the original file is.  However, I've quickly given that up as Microsoft will not allow access to Skydrive, other directories, etc for writing without explicit picker access.</p>
  
  <p>However, I thought maybe I could use the Documents Library.  But any use here seems to give me the NullReferenceException.  Here's a sample of what I was trying (noting that .ged files are associated with my App):</p>
  
  <pre><code>            string backupFileName = openStorageFile + "-backup.ged";
              StorageFolder currentFolder;
              StorageFile fileCopy;
  
              try
              {
                  // try to set up Backup file in the same directory as the source file
                  currentFolder = await selectedFile.GetParentAsync();
                  fileCopy = await openStorageFile.CopyAsync(currentFolder, backupFileName, NameCollisionOption.ReplaceExisting);
  
                  // Success return
                  return;
              }
              catch
              {
                  // The failed... try something else
                  Debug.WriteLine("INFO: Failed to set up backup file in the source file's directory, trying backup option");
              }
  
              try
              {
                  // try to set up Backup file in the same directory as the source file
                  fileCopy = await openStorageFile.CopyAsync(KnownFolders.DocumentsLibrary, backupFileName, NameCollisionOption.ReplaceExisting);
              }
              catch
              {
                  // The failed... try something else
                  Debug.WriteLine("INFO: Failed to set up backup file in the source document library, no other option available");
              }
          }
  </code></pre>
  
  <p>So roughly, The first the first call for GetParentAsync form the original file works.  But CopyAsync to that directory fails with NullReferenceException.</p>
  
  <p>The second try uses DocumentsLibrary.which also fails on CopyAsync with a NullReferenceException.</p>
  
  <p>I tried this:
  <a href="https://stackoverflow.com/questions/15190333/windows-8-storagefile-getfilefrompathasync-using-unc-path">Windows 8 StorageFile.GetFileFromPathAsync Using UNC Path</a></p>
  
  <p>According to MSDN, I shouldn't have an issue as long as my App is associated with .ged files (and it is).  Is there anything else to try?</p>