microsoft / azure-devops-dotnet-samples

.NET/C# samples for integrating with Azure DevOps Services and Azure DevOps Server
https://docs.microsoft.com/azure/devops/integrate
MIT License
519 stars 511 forks source link

There is no sample for listing Policy Evaluations #267

Open JGCreator opened 4 years ago

JGCreator commented 4 years ago

Documentation on "generating" an artifact id is unclear:

Evaluations are retrieved using an artifact ID which uniquely identifies the pull request. To generate an artifact ID for a pull request, use this template:

vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}

And there is no example of how to do this in the repository.

ADD-Juan-Perez commented 4 years ago

Same problem.

We don't know how to create the ArtifactId.

sreeraj-rajendran commented 4 years ago

@JGCreator @juanperezADD I see that this is an old thread. But I had run into this recently, and opened a dev community item. For the artifact id, you should in fact be using vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId} itself.

That was a bit confusing to me as well! Was initially trying out the artifact id of the PR being returned from Get PR rest api - in the format : vstfs:///Git/PullRequestId/{projectId}/{repositoryId}/{pullRequestId}

jpreese commented 4 years ago

Stumbled upon this as well. It's a little confusing that the PR API responds with fields like artifactId and codeReviewId but neither are used in policy evals for the PR.

We had to look at the repository of the PR, and then repository's project, to get its ID for the vstfs://CodeReview artifact for a policy eval.