none
OrganisationFromTenantGuidNotFound RRS feed

  • Question

  • I am trying to send an email using the Graph API

    string SendEmailRequestURI = "https://graph.microsoft.com/v1.0/me/SendMail";

    HttpClient Client = new HttpClient();
    Client.DefaultRequestHeaders.Add("authorization", "bearer " + AccessToken);

    string s = {

      "message": {
        "subject": "Test Email",
        "body": {
          "contentType": "Text",
          "content": "This is a test email"
        },
        "toRecipients": [
          {
            "emailAddress": {
              "address": "stoff@secsol.co.uk"
            }
          }
        ],
      }
    }


    using (var content = new StringContent(s, System.Text.Encoding.UTF8, "application/json"))
    {
      HttpResponseMessage result = Client.PostAsync(SendEmailRequestURI, content).Result;

      string responseText = await result.Content.ReadAsStringAsync();

      if (result.StatusCode == HttpStatusCode.Accepted)
        status = true;
      else
          MessageBox.Show(result.ReasonPhrase + Environment.NewLine + responseText, "Send Email Failed");

    }

    But it returns an error saying OrganisationFromTenantGuidNotFound

    I used the TenantId that is shown against my Application in the Azure AD portal.



    Chris Holland

    Tuesday, June 2, 2020 6:32 AM