Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Query issue is limited to 20 issues

srinivasulu s
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 11, 2013

Hi,

I am using

 // create a connection to JIRA
 var jira = new Jira("http://<your_jira_server>", "<user>", "<password>");

 // use LINQ syntax to retrieve issues
 var issues = from i in jira.Issues
              where i.Assignee == "admin" && i.Priority == "Major"
              orderby i.Created
              select i;
and query result only with first 20 items.
How can i get remaining issues?
 
Thanking you in advance.

7 answers

1 vote
Shivprasad Indewar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 16, 2018

you can achieve this using following code :

 int itemsPerPage=1;

int startAt=0;

IPagedQueryResult<Issue> pagedQueryResult = await _oJira.Issues.GetIssuesFromJqlAsync($"project = {projectName} ORDER BY created DESC", itemsPerPage, startAt);

if (pagedQueryResult.Count() > 0) {

_oJira.MaxIssuesPerRequest = pagedQueryResult.TotalItems;

var listTickets = (from i in _oJira.Issues.Queryable  where i.Project.Equals(projectName, StringComparison.InvariantCultureIgnoreCase) select i).ToList();

}

AshishUpadhyay August 21, 2018

It returns max 1000 even if there are more number of Jira items.

1 vote
tim_mcdougall January 27, 2014

Try setting the MaxIssuesPerRequest property. For instance:

jira.MaxIssuesPerRequest = int.MaxValue;

0 votes
Manuel Serret
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 13, 2021

Since this is the top search result: None of the above issues worked for me: But this works well:

 

private List<Issue> GetIssues()
{
List<Issue> issues = new List<Issue>();

int issuesPerRequest = 100;
int startAt = 0;
int total = 0;

do
{
var newIssues = _client.Issues.GetIssuesFromJqlAsync(string.Empty, maxIssues: issuesPerRequest, startAt).Result;
issues.AddRange(newIssues);

total = newIssues.TotalItems;
startAt = startAt + newIssues.ItemsPerPage;
} while (startAt < total);

return issues;
}
0 votes
Jorge Garay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 4, 2020

I share my solution to the problem, which is getting the issues page by page and storing them in a List:

private static List<Issue> GetIssues(Jira jira, string jql)
{
List<Issue> issues = new List<Issue>();

int incr = 0;
int total = 0;

IssueSearchOptions s = new IssueSearchOptions(jql);

do
{
s.StartAt = incr;
s.MaxIssuesPerRequest = 100;

Task<IPagedQueryResult<Issue>> results = GetIssuesAsyncPaged(jira, s);
results.Wait();

total = results.Result.TotalItems;

foreach (Issue i in results.Result)
{
issues.Add(i);
}

incr += results.Result.Count();

} while (incr < total);

return issues;
}

0 votes
Omar Tarek
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 27, 2017

try "jira.Issues.MaxIssuesPerRequest = 2000"

0 votes
Nikunj Aggarwal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2017

Has this been resolved?

Even when you use int.MaxValue or "-1", the max issues returned is 1000.
How do you get to access all the issues?

Colin Ng
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 19, 2017

I get a limit of 100. :( I had to loop through fetching multiple results. Msg me if you want my sample code. 

Dion Jones
Contributor
October 30, 2017

yup, please Colin - can you post it up?

0 votes
tim_mcdougall January 27, 2014

Has anyone figured this out yet? I am having the same problem...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events