title: Microsoft.Graph send mail with attachment
body: <pre><code>using Microsoft.Graph
  IMessageAttachmentsCollectionPage Message.Attachments
  </code></pre>
  
  <p>I can not seem to get this to take any "ContentBytes" which is in the FileAttachment.ContentBytes. </p>
  
  <p>My sample is from Microsoft <a href="https://github.com/microsoftgraph/aspnet-snippets-sample" rel="nofollow noreferrer">https://github.com/microsoftgraph/aspnet-snippets-sample</a>.</p>
  
  <pre><code>// Create the message.
  Message email = new Message
  {
      Body = new ItemBody
      {
          Content = Resource.Prop_Body + guid,
          ContentType = BodyType.Text,
      },
      Subject = Resource.Prop_Subject + guid.Substring(0, 8),
      ToRecipients = recipients,
      HasAttachments = true,
      Attachments = new[]
          {
              new FileAttachment
              {
                  ODataType = "#microsoft.graph.fileAttachment",
                  ContentBytes = contentBytes,
                  ContentType = contentType,
                  ContentId = "testing",
                  Name = "tesing.png"
              }
          }
  };
  </code></pre>