Use Windows Service to Delete ChatMessage from MS Teams Channel

Woody Cox 46 Reputation points

I am currently evaluating MS Teams as a potential end-point for my company's product offering, and I have a question related to Delegated Permissions.

We would like to use a Windows Service to delete (remove) specific ChatMessages from a Teams Channel. My research and prototyping has proved that sending ChatMessages to a Teams Channel works fine from a Windows Service using Delegated Permissions (the IPublicClientApplication interface is being used for authentication), but the Windows Service is unable to delete the ChatMessages from the Teams Channel.

I am able to log in to the MS Teams Chat Client as the delegated user account and manually delete the ChatMessages, but we need an automated background process (i.e. the Windows Service under development) to perform this action.

Can you please verify my findings - that there is no way for a Windows Service using Delegated Permissions to delete ChatMessages from a Teams Channel?

Thank you,

Woody Cox

Visix, Inc.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,810 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,913 questions
0 comments No comments
{count} votes

Accepted answer
  1. Deva-MSFT 2,256 Reputation points Microsoft Employee

    As per documentation, i see the API will only work for Application permission and not with delegated one.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Manish-MSFT 256 Reputation points

    @Woody Cox , I think @Deva-MSFT has answered it correctly, You need application permission to update/delete chat messages.

    0 comments No comments