title: Upload documents to SharePoint with Metadata c# ASP.NET
body: <p>I am working on a site that makes use of a web service to upload documents to Sharepoint. I have a web service that works and uploads to Sharepoint. However, I need to add metadata to this file being uploaded, such as first name, last name, date of birth etc from a database record, as well as live data from the site. This data is stuff like a 'Workflow number', 'Agreement number', 'Document Type' which gets generated on the site and is associated to that Member and document.</p>
  
  <p>Here is the Code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Web;
  using Microsoft.SharePoint.Client;
  
  namespace DCTMAgent
  {
      public class SharePoint
      {               
          internal void SPUploader(Stream fs, string fn)
          {
              ClientContext context = new ClientContext("http://SharepointSite/Home.aspx");
  
              System.Net.ICredentials creds = System.Net.CredentialCache.DefaultCredentials;
  
              context.Credentials = creds;
              context.RequestTimeout = 60000000; // Time in milliseconds
  
              string url = "/Members/";
              string fileName = Path.GetFileName(fn);                   
  
              string fnUrl = url + fn;
              Microsoft.SharePoint.Client.File.SaveBinaryDirect(context, fnUrl, fs, true);           
          }       
      }
  }
  </code></pre>
  
  <p>How can I change this to upload metadata with the document?</p>