Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this post we’ll share our research on how to import your current project information from JIRA to VSTS.
There is a rising demand from our customers to sync/move project items from JIRA to VSTS in order to support a wide variety of integration scenarios. Capitalizing on how extensible both platforms are, in this post we will walk you through a step-by-step guide on how to create a simple tool to do so.
You'll need to meet the following prerequisites:
These steps were generated as part of our research and shared “as is”. You are encouraged to use and provide feedback; however, these steps and sample code are not supported, nor are any commitments made as to their longevity.
string vstsUrl = "https://{vstsAccount}.visualstudio.com";string vstsPAT = "{vstsPersonalAccessToken}";VssConnection connection = new VssConnection(new Uri(vstsUrl), new VssBasicCredential(string.Empty, vstsPAT));WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
string jUserID = "{jiraUserID}";string jPassword = "{jiraUserPassword}";string jUrl = "https://{jiraAccount}.atlassian.net";Jira jiraConn = Jira.CreateRestClient(jUrl, jUserID, jPassword);
IList issues = (from i in jiraConn.Issues.Queryable orderby i.Created select i).ToList();
If the repositories is big, consider fetching issues by slices.WorkItemClassificationNode all = WorkItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, null, 10).Result;
Navigate in the existing iterations and if necessary, create new values:WorkItemClassificationNode workItemClassificationNode = witClient.CreateOrUpdateClassificationNodeAsync( new WorkItemClassificationNode() { Name = iterationName, }, projectName, TreeStructureGroup.Iterations, parentPath).Result;
Consider creating a local cache of iteration defined in VSTS to avoid querying VSTS multiple times for the same values.JsonPatchDocument document = new JsonPatchDocument(); string title = String.Format ( "[{0}] [{1}] {2}" + , DateTime.Now.ToLongTimeString(), issue.Key, issue.Summary); title = title.Substring(0, Math.Min(title.Length, 128)); document.Add(new JsonPatchOperation { Operation = Operation.Add, Path = "/fields/System.Title", Value = title }); if (issue.Description != null) { document.Add(new JsonPatchOperation { Operation = Operation.Add, Path = "/fields/System.Description", Value = issue.Description }); } [...]
This "mapping" process should take care of all the differences between the item definition in JIRA and in VSTS.JiraUser user = jiraConn.Users.SearchUsersAsync(issue.Reporter).Result.FirstOrDefault(); if (user != null) document.Add(new JsonPatchOperation { Operation = Operation.Add, Path = "/fields/System.CreatedBy", Value = user.Email });
[...]workItem = witClient.CreateWorkItemAsync(document, project, workItemType).Result;[...]
[...] workItem = witClient.UpdateWorkItemAsync(document, id).Result; [...]
This part of the process should take care of the project template state transitions and the work item type management.Authors: Hosam Kamel, João Paulo Rodrigues, Vladimir Gusarov
connection.GetClient();
seems doesn't exists any more. It is necessary now to add a Type
but I don't what kind of Type
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in