Q:

Listing All Changesets and Releated Work Items Belongs to Specific Project Between Specified Dates

I am trying to write a small Relase Notes program with C#. I need to fetch all changesets and related work items belongs to specified project between specified dates.
I tried to use QueryHistory method but i couldn't find how could i give date filter.

A:

You can set
VersionSpec versionFrom = GetDateVSpec(date);
VersionSpec versionTo = GetDateVSpec(DateTime.Now);

Then with
IEnumerable results = versionServer.QueryHistory(sourceControlPath, VersionSpec.Latest, 0, RecursionType.Full, null, versionFrom, versionTo, int.MaxValue, true, true);
List<Changeset> changesets = results.Cast<Changeset>().ToList();

you get the changesets you 're after.
GetDateVSpec goes as follows:
private static VersionSpec GetDateVSpec(DateTime date)
{
   string dateSpec = string.Format("D{0:yyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}", date);
   return VersionSpec.ParseSingleSpec(dateSpec, "");
}

I use this in one of my own tools, originally I had found the core for this here (a great post by Robaticus)

A:

Just found out that there are several classes that inherit from VersionSpec and will do the work for you and are very easy to use. For example, there is a DateVersionSpec which accepts a DateTime. The full list of specific VersionSpec classes is:
WorkspaceVersionSpec
LatestVersionSpec
LabelVersionSpec
DateVersionSpec
ChangesetVersionSpec
Hope this helps.

