18

I'm sure it is obvious and well-deserved that someone downvoted me. Here is the question.

I am not questioning that. I trust the Stack Overflow community.

My question is really about understanding what I need to change to improve my question.

If I am not clear on what is deficient, I can't improve my question.

If you could provide me with some observations about what is wrong with my question, I would really appreciate it.

I am also glad to delete my question if it appears that the question has been asked before (I did a search and couldn't find any similar question) or if the answer is painfully obvious (which it is not yet to me).

7
  • 4
    "Looking for sample code..." - Sounds too much like you're looking for a pre-existing tutorial or something as opposed to just asking how to accomplish something. You don't want to word things in a way that sounds like you're asking for someone to find an off-site resource, since that's off topic. I'm not familiar with TFS so I can't really say whether there's something wrong with the question itself.
    – BSMP
    Mar 28, 2017 at 2:42
  • Thanks @BSMP, I will update the question wording to remove the request for sample code. Mar 28, 2017 at 2:43
  • Also this part in the question itself: "by either pointing sample code"
    – BSMP
    Mar 28, 2017 at 2:43
  • 7
    Removed all mention of sample code. Thanks! I'm still learning the expectations for questions on this site. Mar 28, 2017 at 2:46
  • 3
    Changeset [...] first block of code is misaligned: preferably use exactly 4 markdown spaces to show your code.
    – Cœur
    Mar 28, 2017 at 11:10
  • 3
    For the record, if you get one downvote, it's probably just that someone lost his keys.
    – Nic
    Mar 28, 2017 at 22:21
  • Thanks. In this case, I got very useful information form this discussion! I made changes and the question is now much better received. I plan to fix the formatting as @Coeur suggested and add the answer that I received (and which worked for me). Mar 28, 2017 at 23:53

1 Answer 1

12

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

5
  • 2
    ShelveSet names can be tricky to. In some cases it requires the user name be appended of the owner.
    – AaronLS
    Mar 28, 2017 at 17:45
  • @AaronLS thanks, you might want to add that as a comment or maybe an answer on the question on main. I never used QueryShelveset, I only try to reason about what could explain the down vote or the lack of good answers.
    – rene
    Mar 28, 2017 at 18:04
  • @AaronLS, that was the issue! :-) It is now working. Thanks very much. Now, I just need to figure out how to get Owner from the CodeReview Request. I'm assuming that will be straight forward. Mar 28, 2017 at 20:38
  • 2
    @Rene, thanks very much for your answer. As I have time, I promise to improve my question and I will post the answer that AaronLS provided. Mar 28, 2017 at 20:40
  • 2
    @LarryFreeman thanks for your meta post and constructive cooperation. Glad it worked out well for you. Take care.
    – rene
    Mar 28, 2017 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .