I am creating a TFS webhook to set autocomplete by calling UpdatePullRequestAsync when a pull request is created. However, I am getting the error:
Invalid argument value. Parameter name: Invalid pull request auto-complete set by id. Valid values are either the current user identity id or an empty guid (to unset auto complete).
string createdBy = webHookRequest.resource.createdBy.id.Value;
GitHttpClient gitClient = Connection.GetClient<GitHttpClient>();
var pullRequestWithAutoCompleteEnabled = new GitPullRequest
{
AutoCompleteSetBy = new IdentityRef() { Id = createdBy},
CompletionOptions = new GitPullRequestCompletionOptions
{
SquashMerge = false,
DeleteSourceBranch = false, // false if prefered otherwise
MergeCommitMessage = commitMessage
}
};
GitPullRequest updatedPullrequest = gitClient.UpdatePullRequestAsync(
pullRequestWithAutoCompleteEnabled,
repoId,
prId).Result;