title: Download a file from a specific library in Sharepoint
body: <p>I have a simple console application that upload a file from a local folder to a library in sharepoint, and also have a method that download that folder, but using the url that is activated manually in the web site. But I need to download the same file that I upload a second later, it is for a test, AND WHAT I NEED IS TO ACTIVATE THE "VIEW LINK" FOR DOWNLOAD LATER. Here is my upload method:</p>
  
  <pre><code>  static void o365SaveBinaryDirect(ClientContext o365Context, string o365LibraryName, string o365FilePath, string o365FileName) {
  
          Web o365Web = o365Context.Web;
          if (!LibraryExist(o365Context, o365Web, o365LibraryName)) {
              CreateLibrary(o365Context, o365Web, o365LibraryName);
          }
          using (FileStream o365FileStream = new FileStream(o365FilePath, FileMode.Open)) {
              Microsoft.SharePoint.Client.File.SaveBinaryDirect(o365Context, string.Format("/{0}/{1}", o365LibraryName, o365FileName), o365FileStream, true);                
          }
      }
  </code></pre>
  
  <p>Now I have this method that download:</p>
  
  <pre><code> private static void DownloadFile(string webUrl, ICredentials credentials, string fileRelativeUrl) {
          using (var client = new WebClient()) {
              client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
              client.Headers.Add("User-Agent: Other");
              client.Credentials = credentials;
              client.DownloadFile(webUrl, fileRelativeUrl);
  
          }
      }
  </code></pre>
  
  <p>I need to generate the url for download the file later.</p>