error 404 user id 'X' not found but the user exists

Niv Zetuni 1 Reputation point
2022-10-02T09:47:04.123+00:00

Hey,
I work with Microsoft Graph API specifically on Microsoft Teams, my goal is to bring the apps that a team user uses.

First I use an API that brings the groups that are team with the request:
https://graph.microsoft.com/v1.0//groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')

After that, I take the ID of a group that is a team and I bring all its users with the request:
https://graph.microsoft.com/v1.0/groups/{group-id}/members.

And finally to fetch the apps for each user, I use the request:
https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps

The problem is that there are certain users that when I make the last request I get the error:
"message": "User Id {user-id} not found."

Although if I use the similar request:
https://graph.microsoft.com/v1.0/users/{user-id}
I do get information about that user.

Would appreciate help!

Microsoft Teams | Development
Microsoft Security | Microsoft Graph
{count} votes

3 answers

Sort by: Most helpful
  1. Prasad-MSFT 9,061 Reputation points Microsoft External Staff Moderator
    2022-10-03T07:39:24.797+00:00

    We tried to repro the issue by running below API to get list of installed apps for user and got desired result as below:
    246993-image.png

    Please reverify the {user-id} , if you are using the right one.
    As an alternative, could you please try with {user-principal-name} instead of {user-id} and let us know the results if it helps.

    Thanks,

    Prasad Das


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.


  2. CarlZhao-MSFT 46,376 Reputation points
    2022-10-03T10:12:35.773+00:00

    Hi @Niv Zetuni

    Only administrators can call this api endpoint, and if you are using auth code flow or ROPC flow to obtain a user token, then you need to use global administrator login verification.

    Another approach is to grant TeamsAppInstallation.ReadForUser.All application permissions, and then use the client credential flow to get an application token, which you can also correctly call that endpoint.

    246989-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2022-10-03T15:27:07.347+00:00

    Hi @Niv Zetuni ,

    Based on my test List apps installed for user works with delegated and application permissions and with the request-id the internal error message returned is InvalidRequiredParameter-azureSubscriptionId cannot be null or empty, this would need further analysis.

    247069-image.png

    Also it appears the issue is with the specific user or tenant, request you to open a support ticket with Microsoft and a specialized support engineer will help you better on this.
    You can raise technical support request from
    https://portal.azure.com/#view/Microsoft_Azure_Support/HelpAndSupportBlade/~/overview or https://admin.microsoft.com/#/support/requests.

    247082-image.png

    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra 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.