title: Microsoft Graph API Mail.Send Access Denied
body: <p>I have registered a application in Azure Active Directory as a Daemon authenticating with Client Secrets. I added Graph API Permissions and have granted administrator consent to get a sharepoint list and can successfully pull using the Graph API in c#. I have also granted admin consent to the Mail.Send Graph API but get a access denied. The call is setup correctly and the email address I am using as the From field is the administrators mailbox. IS there some additional configuration or miss configuration I am doing?</p>
  <p>Call to Authenticate
  <code></p>
  <pre><code>var clientSecret = @&quot;{My generated Secret in Azure}&quot;;
  var clientId = @&quot;{My Client Id}&quot;;
  var tenantID = @&quot;{My Tenant Id}&quot;;
  IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
  .Create(clientId)
  .WithTenantId(tenantID)
  .WithClientSecret(clientSecret)
  .Build();
  ClientCredentialProvider authenticationProvider = new ClientCredentialProvider(confidentialClientApplication);
  return new GraphServiceClient(authenticationProvider);
  </code></pre>
  </code>
  <p>My Calling Code to Send Email
  <code></p>
  <pre><code>System.IO.MemoryStream ms = new System.IO.MemoryStream();
  System.IO.StreamWriter writer = new System.IO.StreamWriter(ms);
  writer.Write(htmlDocument.Text);
  writer.Flush();
  writer.Dispose();
  MessageAttachmentsCollectionPage attachments = new MessageAttachmentsCollectionPage();
  attachments.Add(new FileAttachment
  {
  ODataType = &quot;#microsoft.graph.fileAttachment&quot;,
  ContentBytes = ms.ToArray(),
  ContentType = &quot;text/html&quot;,
  ContentId = &quot;testing&quot;,
  Name = &quot;My_Report.html&quot;
  });
  var message = new Message
  {
  Subject = &quot;My Report&quot;,
  Body = new ItemBody
  {
  ContentType = BodyType.Text,
  Content = &quot;Here is your updated report from list&quot;
  },
  ToRecipients = new List&lt;Recipient&gt;()
  {
  new Recipient
  {
  EmailAddress = new EmailAddress
  {
  Address = &quot;{End User to receive report}&quot;
  }
  }
  },
  CcRecipients = new List&lt;Recipient&gt;()
  {
  new Recipient
  {
  EmailAddress = new EmailAddress
  {
  Address = &quot;{my admin email account}&quot;
  }
  }
  },
  From = new Recipient { 
  EmailAddress = new EmailAddress
  { 
  Address = &quot;{my admin email account}&quot;
  }
  },
  Attachments = attachments
  };
  var graphServiceClient = GetGraphServiceClient();
  await graphServiceClient.Me
  .SendMail(message, null)
  .Request()
  .PostAsync();
  </code></pre>
  </code>