title: Upload file to Microsoft OneDrive using graph SDK using asp.net core
body: <p>I am trying to upload a file to OneDrive using Graph SDK for .Net Core from worker service.
  Basically, some files are created at random time and those files needs to be uploaded to specified path on OneDrive from worker service at midnight every day.
  I have following information stored in appconfig.json file in application:</p>
  <ul>
  <li>ClientID</li>
  <li>ClientSecret</li>
  <li>TenantID</li>
  </ul>
  <p>I have checked samples on various sites but could not find how to upload files using above <code>ID</code> and <code>Secret</code>. I believe there must but some kind of <code>authProvider</code> that I could initialize using above <code>ID</code> and <code>Secret</code>.</p>
  <p>I also checked miscrosoft's documentation but coudl not find any example on how to upload file using SDK with <code>ID</code> and <code>Secret</code>.</p>
  <p><a href="https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online</a></p>
  <p><strong>Additional Point</strong></p>
  <ul>
  <li>Upload new file</li>
  <li>Overwrite if file already exists(hope that graph already supports this)</li>
  <li>file size is &lt; 4MB</li>
  <li>path format <code>/folder1/folder2/filename.pdf</code></li>
  </ul>
  <p>Any help would be appreciated.</p>