Skip to content

Commit 00edef8

Browse files
Merge pull request #228366 from jimchou-dev/patch-5
Update data-loss-prevention.md
2 parents abbf2b4 + 83cab99 commit 00edef8

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

articles/communication-services/how-tos/chat-sdk/data-loss-prevention.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ ms.service: azure-communication-services
1010
ms.subservice: chat
1111
ms.custom: template-how-to
1212
---
13-
# How to integrate with Microsoft Teams Data Loss Prevention policies by subscribing to real-time chat notifications
13+
# How to integrate with Microsoft Teams Data Loss Prevention policies
1414

1515
Microsoft Teams administrator can configure policies for data loss prevention (DLP) to prevent leakage of sensitive information from Teams users in Teams meetings. Developers can integrate chat in Teams meetings with Azure Communication Services for Communication Services users via the Communication Services UI library or custom integration. This article describes how to incorporate data loss prevention without a UI library.
1616

1717
You need to subscribe to real-time notifications and listen for message updates. If a chat message from a Teams user contains sensitive content, the message content is updated to blank. The Azure Communication Services user interface has to be updated to indicate that the message cannot be displayed, for example, "Message was blocked as it contains sensitive information.". There could be a delay of a couple of seconds before a policy violation is detected and the message content is updated. You can find an example of such code below.
1818

1919
Data Loss Prevention policies only apply to messages sent by Teams users and aren't meant to protect Azure Communications users from sending out sensitive information.
2020

21+
#### Data Loss Prevention with subscribing to real-time chat notifications
2122
```javascript
2223
let endpointUrl = '<replace with your resource endpoint>';
2324

@@ -28,10 +29,23 @@ let chatClient = new ChatClient(endpointUrl, new AzureCommunicationTokenCredenti
2829

2930
await chatClient.startRealtimeNotifications();
3031
chatClient.on("chatMessageEdited", (e) => {
31-
if(e.messageBody == “” && e.sender.kind == "microsoftTeamsUser")
32-
// Show UI message blocked
32+
if (e.messageBody == "" &&
33+
e.sender.kind == "microsoftTeamsUser") {
34+
// Show UI message blocked
35+
}
3336
});
3437
```
3538

39+
#### Data Loss Prevention with retrieving previous chat messages
40+
```javascript
41+
const messages = chatThreadClient.listMessages();
42+
for await (const message of messages) {
43+
if (message.content?.message == "" &&
44+
message.sender?.kind == "microsoftTeamsUser") {
45+
// Show UI message blocked
46+
}
47+
}
48+
```
49+
3650
## Next steps
3751
- [Learn how to enable Microsoft Teams Data Loss Prevention](/microsoft-365/compliance/dlp-microsoft-teams?view=o365-worldwide)

0 commit comments

Comments
 (0)