If I have the name and owner of Shelveset, I can find it successfully using the following code:
foreach (Shelveset shelveset in
versionControlServer.QueryShelvesets(workItem.
Fields["Associated Context"].Value.ToString(), "NW\\LFreeman"))
where workItem
is an instance of a CodeReviewRequest
workItem
.
I can get the name CodeReviewRequest
fromworkItem.Fields["Associated Context"]
If I set the owner null
as such, it returns an empty list. I was informed that this method will only work if the owner is specified as a string.
I am trying to figure out how to get an owner.
Using workItem.Fields["Associated Context Owner"].Value.ToString()
, I can get the owner GUID.
Now the problem is how to convert the GUID to the expected owner, which will be "NW \ LFreeman".
When I print workItems.Fields["Associated Context Owner"].Value.ToString()
, this is what I see:
c3741a78-1a44-4bf6-95b0-f360cd387f3e
"NW\LFreeman" GUID? , ?
Edit:
, :
Guid ownerId = new Guid(codeReviewRequestWorkItem.Fields["Associated Context Owner"].Value.ToString());
Guid[] teamFoundationIds = new Guid[1];
teamFoundationIds[0] = ownerId;
TeamFoundationIdentity[] users = ims.ReadIdentities((Guid[])teamFoundationIds, MembershipQuery.None);
Shelveset[] shelves = vcs.QueryShelvesets(codeReviewRequestWorkItem.Fields["Associated Context"].Value.ToString(), users[0].UniqueName.ToString());