Share via

JSON operation .value proprety

LoveToCode 161 Reputation points
2021-04-26T21:14:11.037+00:00

Hi, I'm not sure how to use the Source and Rel attributes of .Value property of a json operation object. Below is my code in vb.net.

JDocOpearion = New JsonPatchOperation
             With JDocOpearion
                 .Path = "/relations/-"
                 .Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add
                 Dim link = New WorkItemLink
                 .Value = link.Rel = "System.LinkTypes.Hierarchy-Reverse" _
                 & link.Source.Url = witlink.Source.Url
             End With
Developer technologies | VB

Answer accepted by question author

LoveToCode 161 Reputation points
2021-04-27T07:42:37.773+00:00

I figured it out. here's what I did. @Karen Payne MVP . Please suggest if there's also a better way to do. I love to code. Thank you :)

      JDocOpearion = New JsonPatchOperation  
  
                Dim SRCWitem As New WorkItem  
                Dim WitRelations As New WorkItemRelation  
  
                SRCWitem = WitClient.GetWorkItemAsync(SourceWorkItemID).Result  
  
                WitRelations.Rel = "System.LinkTypes.Hierarchy-Reverse"  
                WitRelations.Title = "Azure devops"  
                WitRelations.Url = SRCWitem.Url  
  
                With JDocOpearion  
                    .Path = "/relations/-"  
                    .Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add  
                    .Value = WitRelations  /* I added the workitemrelations object */  
                End With  
                JSDocument.Add(JDocOpearion)  
  
                Dim a As Object  
                a = WitClient.CreateWorkItemAsync(JSDocument, ProjectName, "Epic")  

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.