I can delete user stories and tasks, no problem, but I can't figure out how to delete a comment from the discussion in a VSTS user story.
-
3D'oh :o !! It's not even editable. Is MS even using their own product ? – Antoine Meltzheim Jul 19 '18 at 09:29
-
3In 2018 AUG, it is still not removable or editable.It is a pain now. – Senura Dissanayake Aug 07 '18 at 05:37
-
3Now it's possible! – IC_ Apr 04 '19 at 16:08
-
It's possible if you are hosting in such a way you can edit the database manually, and you reverse engineer it a little. See my answer below for how I removed an offending discussion item's text in TFS 2017 by manually updating a row in the TFS_DefaultCollection database's dbo.WorkItemLongTexts table. – Brian B May 28 '21 at 19:51
3 Answers
You can't. The work item history is immutable.

- 57,011
- 13
- 100
- 120
-
22This doesn't make much sense to me. Everybody makes mistakes, typos, etc. There's no way to correct anything. If this was a design decision it seems like a poor one to me. Everything else I can think of in a user story is mutable. – Eric Sep 07 '16 at 15:24
-
2It's not deleting but here is the UserVoice link to vote for editing a comment: https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/4118075-edit-comments-on-ticket-s-discussion – Sÿl Apr 01 '18 at 07:48
-
4For whatever it is worth, this is now officially planned in the dev pipeline for Azure DevOps (formerly VSTS). Source: https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/4118075-edit-comments-on-ticket-s-discussion – Kaitebug Sep 27 '18 at 18:43
-
1i see the reason to keep it immutable. but we had someone save a password in the pbi. now it exists forever in the history. wish there was a way to delete it. – Nandun Apr 08 '21 at 15:26
No, it is not possible to delete a comment. However, you can always post a second comment saying not to read the first one and highlight the second comment in red. This will lead to all users ignoring the original comment as if it were deleted.
Edit: It is now possible to delete and edit comments. Edits and deletions may or may not appear in the history. Still, my original answer was a good workaround for the time.

- 91
- 2
- 14
If you are brave and have access to the underlying database, here is how I "removed" a discussion item from a TFS 2017 User Story. I didn't really remove the discussion item itself, I just replaced the actual words users will see from the original words posted to something else. I also don't know if this table is still the same format in later versions of TFS.
Let's say it is the user story (or task, or whatever) with ID of 4004. The ID column of the [WorkItemLongTexts] table below is indexed and matches on the ID of the item being discussed. Here is a query for all the WorkItemLongTexts rows related to this item ID. Here I even narrowed it down further looking for just the row with some of the offensive text you want to find and eliminate using the LIKE clause on the [Words] column:
SELECT TOP (1000) *
FROM [dbo].[WorkItemLongTexts]
WHERE ID = 4004 AND [Words] LIKE '%<stuff you dont like>%'
ORDER BY [AddedDate] DESC
Note that the columns you care most about in this table are [Words] (this is the comment) and [AddedDate] which I use as the index of the row you want to 'fix'.
I then updated the offensive text to something new in this row as follows, pasting the AddedDate of the row you want to fix from your query above into the WHERE clause. The AddedDate should be unique, you can verify with a SELECT on AddedDate with that datetime first to guarantee you will only be changing one row. Here is a sample UPDATE:
UPDATE [dbo].[WorkItemLongTexts] SET [Words] = '-- removed comment --'
where [AddedDate] = '2021-05-28 16:59:37.367'
I offer no guarantee that there will be no side effects of doing this. I don't think there would be, I've not experienced any. I've successfully done this twice in the past 4 years with no issue... We host this TFS database locally still, so the database is available for me to manually update this way.

- 1,509
- 3
- 20
- 29