Actualizar chatMessage Update chatMessage
05/02/2021
Tiempo de lectura: 2 minutos
En este artículo
Actualizar un objeto chatMessage. Update a chatMessage object. Solo se puede actualizar la propiedad policyViolation de un chatMessage. Only the policyViolation property of a chatMessage can be updated.
Permisos Permissions
Se requiere uno de los siguientes permisos para llamar a esta API. Para obtener más información, incluido cómo elegir permisos, vea Permisos . One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Tipo de permiso Permission type
Permisos (de menos a más privilegiados) Permissions (from least to most privileged)
Delegado (cuenta profesional o educativa) Delegated (work or school account)
No admitida. Not supported.
Delegado (cuenta personal de Microsoft) Delegated (personal Microsoft account)
No admitida. Not supported.
Aplicación Application
Chat.UpdatePolicyViolation.All para un mensaje de chat. Chat.UpdatePolicyViolation.All for a chat message. ChannelMessage.UpdatePolicyViolation.All para un mensaje de canal. ChannelMessage.UpdatePolicyViolation.All for a channel message.
Solicitud HTTP HTTP request
PATCH /teams/(team-id)/channels/{channel-id}/messages/{message-id}
PATCH /chats/{chatThread-id}/messages/{message-id}
Nombre Name
Descripción Description
Authorization Authorization
{token} de portador. Obligatorio. Bearer {token}. Required.
Content-Type Content-Type
application/json. Obligatorio. application/json. Required.
Cuerpo de la solicitud Request body
En el cuerpo de la solicitud, especifique una representación JSON de un objeto chatMessage, especificando solo la propiedad policyViolation. In the request body, supply a JSON representation of a chatMessage object, specifying only the policyViolation property.
Respuesta Response
Si se realiza correctamente, este método devuelve una 200 OK
respuesta. If successful, this method returns a 200 OK
response.
Ejemplo Example
Solicitud Request
El siguiente es un ejemplo de la solicitud para actualizar la propiedad policyViolation en un mensaje de canal de Microsoft Teams. The following is an example of the request to update the policyViolation property on a Microsoft Teams channel message.
PATCH https://graph.microsoft.com/v1.0/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19%3Aa21b0b0c05194ebc9e30000000000f61%40thread.skype
Content-Type: application/json
Content-Length: 248
{
"policyViolation": {
"policyTip": {
"generalText" : "This item has been blocked by the administrator.",
"complianceUrl" : "https://contoso.com/dlp-policy-page",
"matchedConditionDescriptions" : ["Credit Card Number"]
},
"verdictDetails" : "AllowOverrideWithoutJustification,AllowFalsePositiveOverride",
"dlpAction" : "BlockAccess"
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var chatMessage = new ChatMessage
{
PolicyViolation = new ChatMessagePolicyViolation
{
PolicyTip = new ChatMessagePolicyViolationPolicyTip
{
GeneralText = "This item has been blocked by the administrator.",
ComplianceUrl = "https://contoso.com/dlp-policy-page",
MatchedConditionDescriptions = new List<String>()
{
"Credit Card Number"
}
},
VerdictDetails = ChatMessagePolicyViolationVerdictDetailsTypes.AllowFalsePositiveOverride | ChatMessagePolicyViolationVerdictDetailsTypes.AllowOverrideWithoutJustification,
DlpAction = ChatMessagePolicyViolationDlpActionTypes.BlockAccess
}
};
await graphClient.Teams["e1234567-e123-4276-55555-6232b0e3a89a"].Channels["a7654321-e321-0000-0000-123b0e3a00a"].Messages["19:a21b0b0c05194ebc9e30000000000f61@thread.skype"]
.Request()
.UpdateAsync(chatMessage);
Lea la documentación del SDK para obtener más información sobre cómo Agregar el SDK a su proyecto y crear una instancia de authProvider. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const chatMessage = {
policyViolation: {
policyTip: {
"generalText" : "This item has been blocked by the administrator.",
"complianceUrl" : "https://contoso.com/dlp-policy-page",
"matchedConditionDescriptions" : ["Credit Card Number"]
},
"verdictDetails" : "AllowOverrideWithoutJustification,AllowFalsePositiveOverride",
"dlpAction" : "BlockAccess"
}
};
let res = await client.api('/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19:a21b0b0c05194ebc9e30000000000f61@thread.skype')
.update(chatMessage);
Lea la documentación del SDK para obtener más información sobre cómo Agregar el SDK a su proyecto y crear una instancia de authProvider. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams/e1234567-e123-4276-55555-6232b0e3a89a/channels/a7654321-e321-0000-0000-123b0e3a00a/messages/19:a21b0b0c05194ebc9e30000000000f61@thread.skype"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphChatMessage *chatMessage = [[MSGraphChatMessage alloc] init];
MSGraphChatMessagePolicyViolation *policyViolation = [[MSGraphChatMessagePolicyViolation alloc] init];
MSGraphChatMessagePolicyViolationPolicyTip *policyTip = [[MSGraphChatMessagePolicyViolationPolicyTip alloc] init];
[policyTip setGeneralText:@"This item has been blocked by the administrator."];
[policyTip setComplianceUrl:@"https://contoso.com/dlp-policy-page"];
NSMutableArray *matchedConditionDescriptionsList = [[NSMutableArray alloc] init];
[matchedConditionDescriptionsList addObject: @"Credit Card Number"];
[policyTip setMatchedConditionDescriptions:matchedConditionDescriptionsList];
[policyViolation setPolicyTip:policyTip];
[policyViolation setVerdictDetails: [MSGraphChatMessagePolicyViolationVerdictDetailsTypes allowOverrideWithoutJustification]];
[policyViolation setDlpAction: [MSGraphChatMessagePolicyViolationDlpActionTypes blockAccess]];
[chatMessage setPolicyViolation:policyViolation];
NSError *error;
NSData *chatMessageData = [chatMessage getSerializedDataWithError:&error];
[urlRequest setHTTPBody:chatMessageData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Lea la documentación del SDK para obtener más información sobre cómo Agregar el SDK a su proyecto y crear una instancia de authProvider. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ChatMessage chatMessage = new ChatMessage();
ChatMessagePolicyViolation policyViolation = new ChatMessagePolicyViolation();
ChatMessagePolicyViolationPolicyTip policyTip = new ChatMessagePolicyViolationPolicyTip();
policyTip.generalText = "This item has been blocked by the administrator.";
policyTip.complianceUrl = "https://contoso.com/dlp-policy-page";
LinkedList<String> matchedConditionDescriptionsList = new LinkedList<String>();
matchedConditionDescriptionsList.add("Credit Card Number");
policyTip.matchedConditionDescriptions = matchedConditionDescriptionsList;
policyViolation.policyTip = policyTip;
policyViolation.verdictDetails = EnumSet.of(ChatMessagePolicyViolationVerdictDetailsTypes.ALLOW_OVERRIDE_WITHOUT_JUSTIFICATION,ChatMessagePolicyViolationVerdictDetailsTypes.ALLOW_FALSE_POSITIVE_OVERRIDE);
policyViolation.dlpAction = EnumSet.of(ChatMessagePolicyViolationDlpActionTypes.BLOCK_ACCESS);
chatMessage.policyViolation = policyViolation;
graphClient.teams("e1234567-e123-4276-55555-6232b0e3a89a").channels("a7654321-e321-0000-0000-123b0e3a00a").messages("19:a21b0b0c05194ebc9e30000000000f61@thread.skype")
.buildRequest()
.patch(chatMessage);
Lea la documentación del SDK para obtener más información sobre cómo Agregar el SDK a su proyecto y crear una instancia de authProvider. Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Respuesta Response
Aquí tiene un ejemplo de la respuesta. Here is an example of the response.
HTTP/1.1 200 OK