public void AddComment() { // Get a work item WorkItem wi = WitClient.GetWorkItemAsync(this.WorkItemsAdded.First()).Result; // Get the current last comment of the work item WorkItemComments comments = WitClient.GetCommentsAsync(wi.Id.Value).Result; var originalCommentCount = comments.Count; // Create a JSON patch document with an entry updating System.History JsonPatchDocument patchDocument = new JsonPatchDocument { new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.History", Value = "Added a comment" } }; // Update the work item with the patch document var result = WitClient.UpdateWorkItemAsync(patchDocument, wi.Id.Value).Result; // Get the current last comment of the work item var updatedComments = WitClient.GetCommentsAsync(result.Id.Value).Result; var updatedCommentCount = updatedComments.Count; // Show that the current last comment is different than the original last comment Console.WriteLine($"There were {originalCommentCount} comments"); Console.WriteLine($"There are now {updatedCommentCount} comments"); Console.WriteLine(); }