title: How to upload a file in a Sharepoint library subfolder using c#?
body: <p>I need to upload a file using c# console app in a sharepoint library. I manage to upload it to the parent library only. But the requirement is to upload it on its sub folder.
  <br/>
  So here's the Folder Structure:</p>
  
  <p>Root Folder<br>
  -Sub Folder 1<br>
  ---Sub Folder 2<br>
  ----Sub Folder 3  </p>
  
  <p>I need to upload it in Sub Folder 3. Right now, I'm only able to upload on the Root Folder. 
  It throws an error when I tried to input the Sub Folder 3 in the GetByTitle method, but when it's the root folder, it is succeeding to upload.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>using (ClientContext clientContext = new ClientContext(siteURL))
  {
      clientContext.Credentials = new System.Net.NetworkCredential(@"username", "password", "domain");
  
      var web = clientContext.Web;
  
      // Create the new file  
      var newFile = new FileCreationInformation();
      newFile.Content = System.IO.File.ReadAllBytes(@"C:\filepath\test.xlsx");
      newFile.Overwrite = true;
      newFile.Url = "Test Upload.xlsx";
  
      List list = web.Lists.GetByTitle("Service Oriented Architecture (SOA)");
      clientContext.Load(list);
      clientContext.ExecuteQuery();
      clientContext.Load(list.RootFolder);
      clientContext.Load(list.RootFolder.Folders);
  
      clientContext.ExecuteQuery();
  
      foreach (Folder SubFolder in list.RootFolder.Folders)
      {
          if (SubFolder.Name.Equals("07 - SOA Environment"))
          {
              //What's next?
          }
      }
  }
  </code></pre>