Find WorkItems that were assigned and finished in the last 30 days - tfs

I would like to see a list of workitems assigned to a particular person. I would also like get information about when those workitems were completed. Is there any column like assigned_date and finished_date that i could use?
I saw [Status]='AssignedTo' but didnt find anything that says when it was assigned and when it was finished
This link provides some info that I am looking for but not everything.

You could use the operator “Was Ever” that searches for a value in a field in the history of Work Items. Such a query will return all Work Items you were/someone assigned to, even if now they are assigned to a different person.
However, there is not any assigned_date and finished_date you could use. Several date and identity fields are set based on workflow states or transitions. You could find all
Date and Iteration Path fields here.
You have to use Revisions - List Rest API to return the list of fully hydrated work item revisions and fetch the work item assigned and finished time. Finally check if they are in the last 30 days.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workItems/{id}/revisions?api-version=6.1-preview.3

Related

How to query 'history' field in Team Foundation Server (TFS)?

I am trying to capture the history of changes when a user story is moved from one iteration to another.
I am trying to query in TFS and using the history field, but don't know what values to put in the value field to capture when a user story is moved to a new iteration. See image below.
I am trying to capture the history of changes when a user story is
moved from one iteration to another.
Unfortunately you cannot capture the information as the History filed is not the real change history for all actions. It just records the Discussion History.
And the work item query is to return work items which matched the given conditions from TFS but not the specific history information.
If you just want to get the real history (iteration change information in your scenario) for a specific work item, then you can call the REST API - Get Work item revisions
If you want to filter the work items which have the specific discussion words, then you can specify the words as the value of the History field. Reference below screenshot:

How to get TFS query result but for a previous date

Is it possible to execute a TFS query and get the results not for today but for a previous date?
I just want to see the results that were available in that date.
To clarify: I need to see the state of the work items on a give date to see their evolution over time.
According to your clarification, you need see the state of the work items on a give date. There is not a direct way to achieve it in Work Item Query.
You can only use Was Ever in Work Item Query to list items based on State past assignments, like:
state Was Ever Active
Or you can use State Change Date <= YYYY-MM-DD and State Change Date > YYYY-MM-DD to list all work items that changed State on YYYY-MM-DD. (Need to check whether TFS 2010 has State Change Date field)
Of course you can combine other clauses to narrow down the query.
What you want is actually the work item history. You need to get the work item history programmatically using TFS API. You can check this blog below to use the API:
http://www.codeproject.com/Articles/243653/TFS-SDK-Work-Item-History-Visualizer-using-TFS-API
I think you can create pivot table report to connect to TFS cube. For your requirement to see work items' evolution over time, you can define the pivot table as:
Check these two links for the details: https://msdn.microsoft.com/en-us/library/ms244678 and https://msdn.microsoft.com/en-us/library/ms244710.aspx

How to get the last modified date of a SharePoint list (SPList)

I have some code which replicates list templates files for new sites in SharePoint 2007. It checks the SPList.LastItemModified to see if there are news entries in order to know whether or not to create a new .STP file.
What I would like though to also be able to see if the list was modified, for example the views and columns, etc.
Can anyone help me out with this? Thank you.
It looks like SPList.LastItemModifiedDate is the value that you want.
According to MSDN:
Gets the date and time that an item, field, or property of the list was last modified.
(emphasis mine)
So it is more than just the last item modified, it is the last time the list was modified.
In order to confirm, I looked at a list that, according to All Site Content, was last modified 4 hours ago (the list is updated each night by a timer job). However, the greatest modified date of any list item was 15 hours ago. I then looked at viewlsts.aspx to see how Last Modified is calculated on the All Site Content page and found the following:
SPUtility.TimeDeltaAsString(spList.LastItemModifiedDate, dtCurrent)
So I would use SPList.LastItemModifiedDate to determine the last time the list was modified, but it is not reliable for retrieving the date of the last list item modified.

Find WorkItems that were assigned to X in the last 30 days

I'm trying to find all WorkItems that were assigned to a person X in the last 30 days.
The big problem I have is the "in the last 30 days"-part.
I thought about using the "ever" or "asof" keywords, but couldn't find a good answer yet.. something like WHERE [Assigned To] = 'X' AND (([Assigned To] != 'X') asof '<30daysago>').
But this is still not a bulletproof solution.
Any better ideas?
Thanks & kind regards
Simon
It appears that this is not possible using just WIQL, but you can get close.
The keyword #Today will give you today's date, then just subtract your range from it. The EVER keyword applied to [Status]='AssignedTo' and a comparison against a date 30 days in the past to [StateChangeDate] is what you'll need to accomplish this.
As close as you can get with WIQL and existing fields:
This says, from all revisions (status changes) return records where the user 'X' has ever been AssignedTo and the State has changed in the last 30 days. This will basically give you a slightly fuzzy picture of what your User has been working on in the last month.
WHERE [Microsoft.VSTS.Common.StateChangeDate] >= #today - 30
AND [System.AssignedTo] EVER 'Bennett Aaron'
ORDER BY [System.State]
Add the missing field:
You could add a custom field called AssignedDate that is captured during the New->AssignedTo workflow transition that you create in the Work Item Definition XML. You can accomplish this using the Team Foundation Server Power Tools extension to Visual Studio. This would give you exactly what you need as well as additional reporting options going forward.
TFS API
I cannot help you with this one, but I believe you could query using the TFS API.
A couple of quick gotchas I've experienced to save you time on ASOF and EVER:
AsOf won't help you by itself with this as it does not support a range of dates. It allows you to query as if it were another date. In other words, if you forgot to capture the results of a query yesterday, you can use an AsOf query to get the results that you would have gotten had it run yesterday. What I understand is that you want to query a basic date range.
EVER might not work as you expect against dates as I believe it uses the exact value of the field (timestamp portion of the date field would be included) it tests with. Just make sure the EVER keyword is used against the status field rather than a date.

In TFS how do I pull all the items that were assigned to me between certain dates in the past?

I am trying to figure out the way to pull all the items that were on my plate between certain dates. Is this possible? Could you please help me to figure out how to write a query for that? Thanks.
The best that I know how to do is to set 'Assigned To' Was Ever #Me, then manually scan the list of work items returned (setting other fields as necessary to filter the results). In the UI, at least, there isn't a way to query on historical data.
You can do this via query window as well, below is my query that i use to see what have i been working on in the past two sprints.
This will give you any tickets you worked on regardless of who they are currently assigned to (system test / uat or whatever).
You can add more clauses and have Changed Date > xxx AND ChangedDate < xxx to find what you are looking for in any given dates.

Resources