Policy Violation Unknown Error

Ohad Gazit 6 Reputation points
2022-06-10T07:20:04.28+00:00

When a chat is created by an EXTERNAL USER that's sending to a known user (in the org).
From time to time we encounter an inconsistent behavior while sending policy violation request regarding a unique msg for the chat.
Using correctly application permissions and verified that all necessary permissions were added.

This is the response err we get
Policy violation chat error: 403 ( {"error":{"code":"Forbidden","message":"UnknownError","innerError":{"date":"2022-XX-XXT11:15:55","request-id":"XXXXXXXX","client-request-id":"XXXXXXXXXXXXXXXX"}}}

While other similar requests on same chat succeeds.
Any ideas what is the cause?
What may go wrong ?
The msg usually contains links / urls .
BR,

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,570 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,843 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ohad Gazit 6 Reputation points
    2022-06-12T07:16:55.877+00:00

    Thanks alot Sayali-MSFT-0291 !

    Step to reproduce:
    1 login to teams with a user to an org with these settings
    210554-image.png

    2 Try to contact the user (open a chat) from an external user (not related to any org )

    3 After failing as expected to get conversationMembers with this api:
    get 403 with something like "chat initiated by a user that is not in roster"

    https://learn.microsoft.com/en-us/graph/api/conversationmember-list?view=graph-rest-1.0&tabs=http&viewFallbackFrom=graph-rest-beta#code-try-1

    4 Try to add a policy violation to the message
    cmd = "PATCH"
    url = "chats/CHAT-ID/messages/MSG-ID"
    with this payload:
    "policyViolation": { "policyTip": { "generalText": "General text" }, "verdictDetails": None, "dlpAction": "BlockAccess", }

    5 Result - Some policyViolation api call succeeds and blocks the msg for the in-org-user.
    Others fails (and does nothing) with Unknown error as posted in the initial question.
    Nothing changed from msg to msg.
    Fails and success seen on the same chat in with same 2 users.
    Fail may happen from both sides, does not matter who the sender is.
    without an change in the surroundings.

    Please update with your findings.
    TY


  2. Sayali-MSFT 2,266 Reputation points Microsoft Vendor
    2022-06-14T10:36:45.21+00:00

    We are unable to repro the scenario.
    We are added gmail user in teams as external user.then create chat and access the chat member using the above API.
    First you need to create a chat with external user using below API-

    POST https://graph.microsoft.com/v1.0/chats

    If you want to find the extrenal user id from your organization use below API-

    GET https://graph.microsoft.com/v1.0/users?$filter=userType+eq+'guest'

    Once you get the external user id you can create a chat with the external user id.
    you will get the chat id once you create chat.You can use this chat id in below API to get the chatmember

    GET https://graph.microsoft.com/v1.0/chats/chat-id/members

    Could you please check it once?
    Ref Doc-1.https://learn.microsoft.com/en-us/graph/api/chat-post?view=graph-rest-1.0&tabs=http
    2. https://learn.microsoft.com/en-us/graph/api/conversationmember-list?view=graph-rest-1.0&tabs=http&viewFallbackFrom=graph-rest-beta#code-try-1

    211279-graphapi.png
    211323-setting.png

    Thanks,

    Sayali


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