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

Need sample for linking GitHub issue #268

Open bobbytreed opened 4 years ago

bobbytreed commented 4 years ago

I'm trying to link a gitHub issue on an AzureDevOps repo with github enabled.

I have tried adding patch data like so, { Operation = Operation.Add, Path = "/relations/-", Value = new { //url = payload.Issue.HtmlUrl, url = @"https://github.com/issueURl", rel = "ArtifactLink", title = payload.Issue.Title,

                    attributes = new
                    {
                        name = "issue",
                        comment = "GitHub Issue"
                    }
                }
            });

But it keeps erroring with Invalid Resource Link Target

Looking at an existing WorkItem, All links are formatted as so:

{
  "rel": "ArtifactLink",
  "url": "vstfs:///GitHub/Issue/guid",
  "attributes": {
    "authorizedDate": "2019-10-04T10:12:48.89Z",
    "id": 2308037,
    "resourceCreatedDate": "2019-10-04T10:12:48.89Z",
    "resourceModifiedDate": "2019-10-04T10:12:48.89Z",
    "revisedDate": "9999-01-01T00:00:00Z",
    "name": "GitHub Issue"
  }
}

How does this vstfs url get generated?