title: how to solve "Microsoft.graph.serviceexception code generalexceptionmessage an error occurred sending the request" while fetching calendar events?
body: <p>I have created an auth provider using  user-password auth provider but and trying to retrieve calendar events in bot code which is in c#, having bot framework 4</p>
  <pre class="lang-cs prettyprint-override"><code>IPublicClientApplication publicClientApplication =
      PublicClientApplicationBuilder
          .Create(&quot;jhnjchdjvd&quot;)
          .WithTenantId(&quot;sdfdf&quot;)
          .Build();
  
  var s = new SecureString();
  s.AppendChar('&lt;');
  s.AppendChar('T');
  s.AppendChar('N');
  s.AppendChar('&gt;');
  s.AppendChar('7');
  
  UsernamePasswordProvider authProvider = new UsernamePasswordProvider(publicClientApplication, scopes);
  
  GraphServiceClient graphClient = new GraphServiceClient(authProvider);
  
  Microsoft.Graph.User me = await graphClient.Me.Request()
      .WithUsernamePassword(&quot;kjkhv@indica.onmicrosoft.com&quot;,
          s).GetAsync();
  
  var events = await graphClient.Me.Events
      .Request()
      .Header(&quot;Prefer&quot;, &quot;outlook.timezone=\&quot;Pacific Standard Time\&quot;&quot;)
      .Select(e =&gt; new
      {
          e.Subject,
          e.Body,
          e.BodyPreview,
          e.Organizer,
          e.Attendees,
          e.Start,
          e.End,
          e.Location
      })
      .GetAsync();
  </code></pre>
  <p>Above code throws exception which is</p>
  <blockquote>
  <p>Microsoft.graph.serviceexception code generalexceptionmessage an error
  occurred sending the request</p>
  </blockquote>
  <p>How can I solve this error?</p>