Endpoint Query Work Item Comments
Name
query_workitem_comments
Description
Get work item comments associated with the specified project and organization that are filtered by a Wiql query. (A team can optionally be specified as well.). Read more about this API here https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/wiql/query-by-wiql?view=azure-devops-rest-7.0 and here https://learn.microsoft.com/en-us/azure/devops/boards/queries/query-operators-variables?view=azure-devops [API reference]
Related Tables
Parameters
| Parameter | Required | Options | ||||||
|---|---|---|---|---|---|---|---|---|
|
Name:
Label: Project Name The Name of the project. |
YES | |||||||
|
Name:
Label: Wiql Query The WIQL query (refer Azure DevOps Help to learn Wiql syntax. |
YES | |||||||
|
Name:
Label: Team Id or Name Id or name of the team associated with the query. |
||||||||
|
Name:
Label: Use time precision Whether or not to use time precision. |
|
Output Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| Id |
DT_I4
|
int
|
||
| WorkItemId |
DT_I4
|
int
|
||
| Text |
DT_NTEXT
|
nvarchar(MAX)
|
||
| RenderedText |
DT_NTEXT
|
nvarchar(MAX)
|
||
| Format |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| CreatedDate |
DT_DBTIMESTAMP
|
datetime
|
||
| CreatedByUniqueName |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| CreatedById |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| CreatedByDisplayName |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| ModifiedDate |
DT_DBTIMESTAMP
|
datetime
|
||
| ModifiedByUniqueName |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| ModifiedById |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| ModifiedByDisplayName |
DT_WSTR
|
nvarchar(4000)
|
4000 | |
| Url |
DT_WSTR
|
nvarchar(1000)
|
1000 |
Input Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Examples
SSIS
Use Azure DevOps Connector in API Source or in API Destination SSIS Data Flow components to read or write data.
API Source
This Endpoint belongs to the WorkItemComments table, therefore it is better to use it, instead of accessing the endpoint directly:
| Required Parameters | |
|---|---|
| Project Name | Fill-in the parameter... |
| Wiql Query | Fill-in the parameter... |
| Optional Parameters | |
| Team Id or Name | |
| Use time precision | |
API Destination
This Endpoint belongs to the WorkItemComments table, therefore it is better to use it, instead of accessing the endpoint directly. Use this table and table-operation pair to query work item comments:
| 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
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')
query_workitem_comments endpoint belongs to
WorkItemComments
table(s), and can therefore be used via those table(s).
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];
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];
query_workitem_comments endpoint belongs to
WorkItemComments
table(s), and can therefore be used via those table(s).