I used the following code to apply a policy violation, and it is working fine:
public static void PolicyViolation(string chatId, string messageId)
{
try
{
GraphServiceClient graphClient = StaticVariables.GetGraphServiceClientAsync();
ChatMessage updatedMessage = new ChatMessage();
updatedMessage.PolicyViolation = new ChatMessagePolicyViolation()
{
PolicyTip = new ChatMessagePolicyViolationPolicyTip()
{
GeneralText = "Custom Text to block message",
MatchedConditionDescriptions = new List<string>() { "Global (Org-wide default)" }
},
DlpAction = ChatMessagePolicyViolationDlpActionTypes.BlockAccess,
VerdictDetails = ChatMessagePolicyViolationVerdictDetailsTypes.AllowFalsePositiveOverride,
};
var result1 = graphClient.Chats[chatId].Messages[messageId].PatchAsync(updatedMessage).Result;
Console.WriteLine("Policy Violation Applied.");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
This code gives me the option to “Report this message and send” within Microsoft Teams. However, when I do this, I don’t receive any alert or email as an admin.
Where do we receive notifications when a user reports these policy-violated messages to the admin?