Table WorkItemComments
Description
No description available
Supported Operations
Below section contains supported CRUD operations. Each operation is executed by some EndPoint behind the scene.| Method | Supported | Reference EndPoint |
|---|---|---|
| SELECT | query_workitem_comments | |
| INSERT | add_workitem_comment | |
| UPDATE | update_workitem_comment | |
| UPSERT | ||
| DELETE | delete_workitem_comment | |
| LOOKUP |
Examples
SSIS
Use Azure DevOps Connector in API Source component to read data or in API Destination component to read/write data:
Read from WorkItemComments table using API Source
| Required Parameters | |
|---|---|
| Project Name | Fill-in the parameter... |
| Wiql Query | Fill-in the parameter... |
| Optional Parameters | |
| Team Id or Name | |
| Use time precision | |
Read/write to WorkItemComments table using API Destination
| Required Parameters | |
|---|---|
| Project Name | Fill-in the parameter... |
| Wiql Query | Fill-in the parameter... |
| Optional Parameters | |
| Team Id or Name | |
| Use time precision | |
ODBC application
Use these SQL queries in your ODBC application data source:
List all work item comments
<p>Returns all comments across work items in the default (or specified) scope. Use when you need a flat list of comments for reporting or search. Filter by WorkItemId or Id in the WHERE clause to narrow to one work item or one comment.</p>
SELECT * FROM WorkItemComments
List comments for a work item
<p>Returns all comments for a single work item. Filter by WorkItemId in the WHERE clause. Use this to show discussion history for one bug, task, or story. Columns include Id, Text, RenderedText, CreatedDate, CreatedBy, and ModifiedDate.</p>
SELECT * FROM WorkItemComments
WHERE WorkItemId=6455
Get comment by ID for a work item
<p>Returns one comment by its ID for a given work item. Filter by both WorkItemId and Id to retrieve a single comment row. Use when you need to update or reference a specific comment.</p>
SELECT * FROM WorkItemComments
WHERE WorkItemId=6455 and Id=5283490
Query work item comments using WIQL
<p>The WIQL query in the WITH clause selects which work items to include; comments for those work items are returned. You can filter by project, ID, or any WIQL criteria. Columns include Id, WorkItemId, Text, RenderedText, CreatedDate, CreatedBy, ModifiedDate, and Url. Use this when you need comments for a specific set of work items defined by a query rather than a single work item ID.</p>
SELECT
Id
, WorkItemId
, Text
, RenderedText
, Format
, CreatedDate
, CreatedByUniqueName
, CreatedById
, CreatedByDisplayName
, ModifiedDate
, ModifiedByUniqueName
, ModifiedById
, ModifiedByDisplayName
, Url
FROM WorkItemComments
--WHERE Id=5283490 -- get just one comment for specific WorkItem Id
WITH(Query='SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject]=''ProductTesting'' and [System.Id]=6455 ORDER BY [System.Id] DESC')
Create work item comment
<p>Adds a new comment to a work item. Supply WorkItemId and the comment Text; the text can include HTML (e.g. bold, links). Specify the project in WITH. The new comment gets an ID and timestamps; you can use it in follow-up updates or links.</p>
INSERT INTO WorkItemComments(WorkItemId, Text)
VALUES(6455, 'Adding <strong>html comment</strong> - created on <<FUN_NOW>>')
WITH(Project='ProductTesting')
Update work item comment
<p>Updates the text of an existing comment. Identify the comment by WorkItemId and Id in the WHERE clause; set the new Text in SET. Specify the project in WITH. Useful for correcting or expanding a comment after creation.</p>
UPDATE WorkItemComments
SET Text='Updating <strong>html comment</strong> - updated on <<FUN_NOW>>'
Where WorkItemId=6455 and Id=5284411
WITH(Project='ProductTesting')
Delete work item comment by ID
<p>Deletes a single comment by its ID and work item ID. The comment is removed from the work item. Use when you need to remove one comment from the discussion thread.</p>
DELETE FROM WorkItemComments WHERE WorkItemId=6455 and Id=5284411
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
List all work item comments
<p>Returns all comments across work items in the default (or specified) scope. Use when you need a flat list of comments for reporting or search. Filter by WorkItemId or Id in the WHERE clause to narrow to one work item or one comment.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM WorkItemComments';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];
List comments for a work item
<p>Returns all comments for a single work item. Filter by WorkItemId in the WHERE clause. Use this to show discussion history for one bug, task, or story. Columns include Id, Text, RenderedText, CreatedDate, CreatedBy, and ModifiedDate.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM WorkItemComments
WHERE WorkItemId=6455';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];
Get comment by ID for a work item
<p>Returns one comment by its ID for a given work item. Filter by both WorkItemId and Id to retrieve a single comment row. Use when you need to update or reference a specific comment.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM WorkItemComments
WHERE WorkItemId=6455 and Id=5283490';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];
Query work item comments using WIQL
<p>The WIQL query in the WITH clause selects which work items to include; comments for those work items are returned. You can filter by project, ID, or any WIQL criteria. Columns include Id, WorkItemId, Text, RenderedText, CreatedDate, CreatedBy, ModifiedDate, and Url. Use this when you need comments for a specific set of work items defined by a query rather than a single work item ID.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT
Id
, WorkItemId
, Text
, RenderedText
, Format
, CreatedDate
, CreatedByUniqueName
, CreatedById
, CreatedByDisplayName
, ModifiedDate
, ModifiedByUniqueName
, ModifiedById
, ModifiedByDisplayName
, Url
FROM WorkItemComments
--WHERE Id=5283490 -- get just one comment for specific WorkItem Id
WITH(Query=''SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject]=''''ProductTesting'''' and [System.Id]=6455 ORDER BY [System.Id] DESC'')';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];
Create work item comment
<p>Adds a new comment to a work item. Supply WorkItemId and the comment Text; the text can include HTML (e.g. bold, links). Specify the project in WITH. The new comment gets an ID and timestamps; you can use it in follow-up updates or links.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO WorkItemComments(WorkItemId, Text)
VALUES(6455, ''Adding <strong>html comment</strong> - created on <<FUN_NOW>>'')
WITH(Project=''ProductTesting'')';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];
Update work item comment
<p>Updates the text of an existing comment. Identify the comment by WorkItemId and Id in the WHERE clause; set the new Text in SET. Specify the project in WITH. Useful for correcting or expanding a comment after creation.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'UPDATE WorkItemComments
SET Text=''Updating <strong>html comment</strong> - updated on <<FUN_NOW>>''
Where WorkItemId=6455 and Id=5284411
WITH(Project=''ProductTesting'')';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];
Delete work item comment by ID
<p>Deletes a single comment by its ID and work item ID. The comment is removed from the work item. Use when you need to remove one comment from the discussion thread.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'DELETE FROM WorkItemComments WHERE WorkItemId=6455 and Id=5284411';
EXEC (@MyQuery) AT [LS_TO_AZURE_DEVOPS_IN_GATEWAY];