Share via

Issues hiding chat for user through Graph API

Akash Mudgal 0 Reputation points
2024-04-07T05:15:50.88+00:00

I am having issues hiding chat with graph API.

The API call I am using is https://learn.microsoft.com/en-gb/graph/api/chat-hideforuser?WT.mc_id=M365-MVP-5001530&view=graph-rest-1.0&tabs=http

I am supplying the request body as following:

{
      user: {
        id: userId
      },
    }

The service principal I am using has delegated Chat.ReadWrite Permission, and the user Id being used in the request body is same as the caller user.

Still, I keep getting the error Bad Request:

{"error":{"code":"BadRequest","message":"The user for whom the chat should be hidden must be specified.","innerError":{"date":"2024-04-07T05:08:48","request-id":"667dab50-60a3-4b58-8103-cd210e69975f","client-request-id":"667dab50-60a3-4b58-8103-cd210e69975f"}}}

Please help me understand what am I doing wrong?

Regards,

Akash Mudgal

Microsoft Security | Microsoft Graph
0 comments No comments

2 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 46,456 Reputation points
    2024-04-08T08:14:20.7133333+00:00

    Hi @Akash Mudgal

    As a test, try logging into Graph Explorer using your user and calling this endpoint.

    9f6aaa4f-4bcd-42cb-95c8-3c22e1e1606b

    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.

    Was this answer helpful?


  2. AsithwMSFT 1,520 Reputation points Microsoft External Staff
    2024-04-07T21:57:20.3566667+00:00

    @Akash Mudgal

    Have you attempted to include the tenant ID in the request body as suggested in the documentation?

    {
      "user": {
        "id" : "d864e79f-a516-4d0f-9fee-0eeb4d61fdc2",
        "tenantId": "2a690434-97d9-4eed-83a6-f5f13600199a"
      }
    }
    

    Was this answer helpful?


Your answer

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