When I use the graph api to call Users, I don't get the updated user profile.

宇涛 梁 0 Reputation points
2023-03-16T04:08:36.2633333+00:00

When I use the graph api to call Users, I get some information about users, but I update some user profiles from aad users, but when I call the api again, it is not updated.

here is code:

  [HttpGet]
        public async Task<ActionResult<List<User>>> GetAllUsers()
        {
            var clientId = _configuration.GetValue<string>("AzureAd:ClientId");
            var tenantId = _configuration.GetValue<string>("AzureAd:TenantId");
            var clientSecret = _configuration.GetValue<string>("AzureAd:ClientSecret");
            var clientSecretCredential = new ClientSecretCredential(tenantId,clientId, clientSecret);
            GraphServiceClient graphServiceClient = new GraphServiceClient(clientSecretCredential);
            var users = await graphServiceClient.Users.GetAsync();
            return Ok(users);
        }

User's image

User's image

User's image

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. risolis 8,741 Reputation points
    2023-03-16T05:17:52.4633333+00:00

    Hello @宇涛 梁

    Thank you for posting this concern on this community space.

    I was reading your case scenario description and I want to know if you are following this requirement down below:

    User's image

    I hope that can be helpful for you.

    Looking forward to your feedback,

    Cheers,

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. CharanyaB-MSFT 1,891 Reputation points
    2023-03-16T05:33:57.3333333+00:00

    Hello @宇涛 梁,

    Thanks for reaching out!

    The updates from AAD take few minutes to reflect on the Graph API call. Please try to execute the users API after few minutes for the changes to apply.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.