M365 Agent icon

M365 Agent

Send messages, cards, thread replies, and invoke responses through Microsoft 365 Agents (Teams / Copilot / WebChat).

Actions28

Message → Delete

AI-generated

Summary

Delete a message from a Microsoft Teams conversation. Defaults to using the conversation reference from the workflow item envelope, which automatically handles reply/update/delete flows. To operate proactively outside a reply/update flow, set conversation source to manual and provide the service URL, conversation ID, and channel ID. Choose authentication kind: classicBot (Azure Bot Service + Entra App Registration) or agent365 (Entra Agent Identity). For agent365, identity mode selects whether the agent acts as its Blueprint app (autonomous) or as its own M365 user (agentUser, requires sidecar transport and separate license). User selector mode chooses between UPN or Object ID when using agentUser identity.

Inputs

  • authKind (required) — Authentication method: classicBot (Azure Bot Service + Entra App) or agent365 (Entra Agent Identity).
  • conversationSource — Source of conversation routing info. Defaults to 'envelope' (uses conversationReference from current item). Select 'manual' to provide service URL, conversation ID, and channel ID explicitly.
  • serviceUrl — Bot Connector service URL for the target channel. Required when conversationSource is 'manual'.
  • conversationId — The conversation ID (e.g., 19:xxx@thread.tacv2 for Teams). Required when conversationSource is 'manual'.
  • channelId — Azure Bot Service channel the conversation belongs to. Defaults to 'msteams'. Options: directline, emulator, msteamscopilot, msteams, webchat.
  • activityId — Required only for Delete operations against a specific activity. Leave empty for general message deletion.
  • identityMode — Only available when authKind is 'agent365'. 'autonomous' acts as the Blueprint app identity; 'agentUser' acts as the agent's own M365 user (requires sidecar transport and separate license).
  • userSelectorMode — Only available when authKind is 'agent365' and identityMode is 'agentUser'. 'byUpn' selects by user principal name; 'byObjectId' selects by Azure AD object ID.
  • agentUsername — UPN of the agentic user. Shown when authKind is 'agent365', identityMode is 'agentUser', and userSelectorMode is 'byUpn'. Defaults to credential's Default Agent Username.
  • agentUserId — Object ID of the agentic user. Shown when authKind is 'agent365', identityMode is 'agentUser', and userSelectorMode is 'byObjectId'.

Output shape

Confirmation of message deletion. Exact return shape depends on authentication kind and configuration, but typically indicates success or returns the deleted message reference.

Conversation source defaults to 'envelope', which automatically provides the conversation reference from the workflow item. Manual mode is required for proactive deletion outside of reply/update contexts.

Examples

Example 1: Delete the most recent message in a Teams channel using envelope-sourced conversation reference.

authKind: classicBot; conversationSource: envelope (default). The node extracts the conversation reference from the incoming item and deletes the associated message.

Example 2: Proactively delete a message by ID in a specific Teams channel.

authKind: agent365; conversationSource: manual; serviceUrl: https://smba.trafficmanager.net/emea/; conversationId: 19:123@thread.tacv2; channelId: msteams; identityMode: autonomous.

Links

Discussion