In our workplace, we use SharePoint and JIRA as issue trackers. In SharePoint, we have a list called "Work Requests," which store issue information in SharePoint list items. Before, we have had to manually create JIRA stories from these Work Requests, but I have created a c# program that will automtically take this SharePoint data and create JIRA tasks. This is what my program is right now with my urls replaced with default values:
using Atlassian.Jira;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
namespace ConsoleApplication3
{
public class Jira_SP_API
{
public static void Main(string[] args)
{
Jira jira = Jira.CreateRestClient("JIRA url", "username", "password");
var context = new SharePoint.ITDataContext(
new Uri("SharePoint url"));
context.Credentials = System.Net.CredentialCache.DefaultCredentials;
var workrequests = from request in context.WorkRequests
where request.Id > 240
where request.RequestStatusValue != null
orderby request.Id
select new
{
request.Id,
request.Title,
request.RequestStatusValue,
request.PriorityValue,
request.RequestDate,
request.Requestor.Name,
request.BusinessApprover.FirstName,
request.BusinessApprover.LastName,
request.WorkAssignedTo,
request.FunctionalArea,
request.WorkRequestFormReadOnly
};
foreach (var request in workrequests)
{
try
{
var issue = jira.CreateIssue("TEST");
issue.Type = "Task";
/*issue["customfield_10044"] = request.Id;*/
issue.Priority = request.PriorityValue;
issue.Summary = request.Title;
issue["customfield_10045"] = request.WorkRequestFormReadOnly;
issue["customfield_10050"] = request.FunctionalArea;
issue["customfield_10047"] = request.Title;
issue["customfield_10048"] = request.Name;
issue["customfield_10049"] = request.FirstName + ' ' + request.LastName;
issue["customfield_10046"] = null;
issue["customfield_10051"] = null;
issue["customfield_10052"] = null;
issue.SaveChanges();
}
catch (Exception) { }
Console.WriteLine(request.Id);
Console.WriteLine(request.Title);
Console.WriteLine(request.RequestStatusValue);
Console.WriteLine(request.PriorityValue);
Console.WriteLine(request.RequestDate);
Console.WriteLine(request.Name);
Console.WriteLine(request.FirstName + ' ' + request.LastName);
Console.WriteLine(request.WorkAssignedTo);
}
Console.ReadKey();
}
}
}
Basically my issue is that my program will create tasks when I don't have the custom fields in my foreach statement, but as soon as I put them in, my program will no longer create tasks. Is my formatting wrong? Or are the custom fields not supposed to work this way? Thanks in advance.
Hi guys
This is what the JSON looks like when I create an issue with a custom field :
"customfield_11100": {
"value": "Non Project"
},
I hope this helps you
Hey Warren,
So you create your JSON from sharepoint and trying to create the issue in Jira ? Just trying to understand on the integration of sharepoint and jira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I don't work with SharePoint. I was mainly answering the question about creating an issue with a custom field.
In theory you should be able "get" Jira data into SharePoint and also create Jira issues from SharePoint, as long as you're able to work with the API (which should be possible). In fact my company is considering a project of doing exactly this, but the SharePoint developers will be involved, not me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried this:
issue.CustomFields.AddById("customfield_10045", request.WorkRequestFormReadOnly); //Link to Work Request
issue.CustomFields.AddById("customfield_10050", request.FunctionalArea); //Functional Area
issue.CustomFields.AddById("customfield_10047", request.Title); //Title
issue.CustomFields.AddById("customfield_10048", request.Name); //Requestor
issue.CustomFields.AddById("customfield_10049", request.FirstName + ' ' + request.LastName); //Approver
Still doesn't create the issue in JIRA. But this creates an issue when I remove the custom fields:
var issue = jira.CreateIssue("TEST");
issue.Type = "Story";
issue.Priority = request.PriorityValue;
issue.Summary = request.Title;
issue.SaveChanges();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Trey,
Am looking for similar kind of solution. would love to hear if you were able to integrate between sharepoint and jira ? if so do you mind sharing how you implemented it.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.