For me there is a disconnect between what you ask:
Could someone help me to understand what I need to change so that versionControlServer.QueryShelvesets("ShelvesetName",null) returns the shelveset with the name that matches the Associated Context of the CodeReviewRequest work item?
and the code examples. The two for loops are close to useless to determine if there is something wrong with your setup, as your code seems to be OK (which is also confirmed now by an MSFT employee). At best that code example would have been like this:
foreach (Shelveset shelveset in versionControlServer.QueryShelvesets(null,null) {
foreach (Shelveset shelvesetInner in versionControlServer.QueryShelvesets(shelveset.Name,null))
{
Console.WriteLine(shelvesetInner.Name);
}
}
because if that doesn't return anything, the method QueryShelvesets
doesn't behave as advertised.
All that is left now is a possible typo in your shelveset name which we can't verify because you didn't share the output of your first for-loop.
I think it would help if you include the code how you get hold of the shelveset name from that ChangeSet
, what its actual name is, how it does show up in the complete list of ShelveSets while it still returns an empty list when put directly in QueryShelvesets
.
Users with experience with that API might notice the shelveset name needs escaping, or mention permission issues or offer an alternative alltogether
Changeset [...]
first block of code is misaligned: preferably use exactly 4 markdown spaces to show your code.