Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

92
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda