Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
Cannot fetch users present in Azure AD from Microsoft graph API

I have made a MVC application and I'm trying to add users to application.

The validation of user needs to be done through Azure AD for which Graph API is used.

Internal users presented in Azure AD are added successfully.

External users are also presented in Azure AD but I get the error

User not present in AD

I have tried applying all filters but still getting the same issue.

Code used:

var authProvider = await GetAuthProvider();
GraphServiceClient graphClient = new GraphServiceClient(authProvider);

var user = await graphClient.Users[email].Request().GetAsync();
return true;

where email is the string of email passed from application. The code works fine for internal users but not for external users.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The issue is that you are using mail property but you should use userPrincipalName

mail has form like this

AdeleVance@adatum.com

but userPrincipalName for external user has different form

AdeleVance_adatum.com#EXT#@contoso.com
AdeleVance_adatum.com#EXT#@contoso.onmicrosoft.com

To query a external user using the userPrincipalName, encode the hash (#) character. Replace the # symbol with %23.

AdeleVance_adatum.com%23EXT%23@contoso.com

But graphClient should encode the hash character automatically.

Resources:

Get a user: HTTP request

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda