我正在查询一个PortfolioItem/Mmf
. 这工作正常:
new Request("PortfolioItem/Mmf")
{
ProjectScopeUp = false,
ProjectScopeDown = true,
Fetch = new List() { "Name", "Description", "FormattedID", "LastUpdateDate", "Owner", "Children" },
Query = new Query("FormattedID", Query.Operator.Equals, _formattedID)
};
但是当我像这样查询引用地址(我可以在浏览器上打开并完美检查 json)时:
//_childFetch contains the same Fetch string list from the previous query
var childObject = m_rallyApi.GetByReference(_childRef, _childFetch);
它返回空值。
为什么这不起作用?当它是分层要求时,这两个查询都可以工作。
使用 GetByReference()编辑方法的完整代码
private HierarchicalRequirement GetUserStoryByReference(string _childRef, string[] _childFetch)
{
HierarchicalRequirement userStory = null;
var childObject = m_rallyApi.GetByReference(_childRef, _childFetch);
if (childObject["Children"].Count == 0)
{
userStory = new HierarchicalRequirement(childObject);
}
else
{
if (childObject["Children"].Count > 0)
{
userStory = new HierarchicalRequirement(childObject);
foreach (var child in childObject["Children"])
{
userStory.Children.Add(GetUserStoryByReference(child["_ref"], _childFetch));
}
}
}
return userStory;
}