QueryHistory() by date range
-
Friday, February 10, 2012 12:48 PM
hi all,
i would like to query the history for a certain date range. Is there a way to achieve this? QueryHistory() doesn't take
a date range as parameters. Thanks for any hints.
Peter
yb
All Replies
-
Friday, February 10, 2012 1:57 PM
You can use VersionSpec to enter versionFrom and versionTo parameters of the method QueryHistory.
For exemple:
VersionSpec versionFrom = GetDateVSpec(date);
VersionSpec versionTo = GetDateVSpec(DateTime.Now);
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, "");
}
You can find it here:
Best Regards,
Ivan
Ivan Kardum
PMP, MCSD, MCPD, MCTS:TFS
Blog: Kardum Software Development Storyboard
Please remember to click “Mark as Answer” on the post that helps you.- Edited by IvanKardumMVP Saturday, February 11, 2012 7:19 AM
- Marked As Answer by John QiaoMicrosoft Contingent Staff, Moderator Monday, February 13, 2012 9:15 AM
-
Friday, February 10, 2012 1:59 PM
I Guess QueryHistory does take date range as parameters. You have to use VersionSpec to provide from and to.
QueryHistory Reference. http://msdn.microsoft.com/en-us/library/bb138960(v=vs.100).aspx
public IEnumerable QueryHistory( string path, VersionSpec version, int deletionId, RecursionType recursion, string user, VersionSpec versionFrom, // Provide From VersionSpec versionTo, // Provide To int maxCount, bool includeChanges, bool slotMode )
Abhimanyu Singhal
- Marked As Answer by John QiaoMicrosoft Contingent Staff, Moderator Monday, February 13, 2012 9:15 AM
-
Monday, February 13, 2012 1:58 AMModerator
Hi Peter,
Thanks for your post.
For this issue, our members provided us the better code snippet, please confirm them.
If misunderstood anything, please describe your question in more detail and we will be able to provide the better responses.
John Qiao [MSFT]
MSDN Community Support | Feedback to us
-
Monday, February 13, 2012 9:13 AM
hi all,
thanks for all the help. That works fine!
regards,
Peter
Peter

