QueryResult result = null;
IAssetType storyType = _v1Server.MetaModel.GetAssetType("Story");
Query query = new Query(storyType, true); //here true is for historical
FilterTerm term = new
FilterTerm(storyType.GetAttributeDefinition("ID"));
term.Equal(story.ID); //here is your story - and it works for epics too,
but you must be carefull when you cast to/from US/Epic
query.Filter = term;
try
{
query.OrderBy.MajorSort(storyType.GetAttributeDefinition("ChangeDate"),
OrderBy.Order.Descending);
result = _v1Server.Services.Retrieve(query);
}
catch (Exception e)
{
}
foreach (Asset asset in result.Assets)
{
AssetID assetIn = AssetID.FromToken(asset.Oid.Token);
try
{
Story oldStory = v1Inst.Get.StoryByID(assetIn);
//display here the state of the object
}
catch (InvalidCastException)
{
//Epic converted to Story
Epic oldEpic = null;
try
{
oldEpic = v1Inst.Get.EpicByID(assetIn);
//display here the state of the object
}
catch (Exception ex)
{
}
}
}
Hope this helps, it took me a while till I figured it all out :)
Hi,
Regards
William
--
You received this message because you are subscribed to the Google
Groups "VersionOne-dev" group.
To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to
versionone-de...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/versionone-dev?hl=en.