/ SDKs / .NET
SDKs
Chat SDKs .NET v4
Chat SDKs .NET
Chat SDKs
.NET
Version 4

Delete a message

Copy link

Users can delete any message they themselves have sent. An error is returned if a user attempts to delete messages sent by other users. Also channel operators can delete any messages in a channel.

channel.DeleteMessage(MESSAGE_ID, (inError) =>
{
    if (inError != null)
    {
        return; // Handle error.
    }

    // The messageId parameter indicates a messageId from the BaseMessage object.
    // The message is successfully deleted from the channel.
});

After a message is successfully deleted, the OnMessageDeleted() method in the channel event handler is invoked on all users' devices including the device where the message was deleted.

SbOpenChannelHandler channelHandler = new SbOpenChannelHandler
{
    OnMessageDeleted = (inChannel, inMessageId) => 
    {
        // Handle event here.
    }
};