我从redmine timeentry
获取数据。
问题是我只获得了最近25条记录。 我的过滤器无效
任何想法,为什么过滤器不起作用或我正在做什么类型的错误?
我已经从redmine
Nuget
的包
以下是代码:
string host = "redmine.xyz.net";
string apiKey = "e69e2243f4b357f34533322408d6339b7f5b2579e36";
var manager = new RedmineManager(host, apiKey);
List<EEmployeeTimeSheet> liEmpTimeSheet = new List<EEmployeeTimeSheet>();
var parameters = new NameValueCollection();
parameters.Add("per_page", "100");
parameters.Add("created_on", DateTime.Now.Date.ToString("yyyy-MM-dd"));
XmlWriterSettings settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.CloseOutput = false;
XmlWriter xmlWriter = XmlWriter.Create(Path.Combine(HostingEnvironment.MapPath("~/test.xml")), settings);
var timeentry=manager.GetObjectList<TimeEntry>(parameters).Take(100);
foreach (var issue in timeentry)
{
issue.WriteXml(xmlWriter);
EEmployeeTimeSheet emp = new EEmployeeTimeSheet();
emp.strActivity = issue.Activity.ToString();
emp.strComments = issue.Comments;
emp.nHours = issue.Hours;
emp.dtCreatedOn = issue.CreatedOn;
emp.strProject = issue.Project.Name;
emp.strEmployeeName = issue.User.Name;
liEmpTimeSheet.Add(emp);
}
xmlWriter.Flush();
xmlWriter.Close();
答案 0 :(得分:0)
默认情况下,API仅返回25个项目。 您可以使用GetObjects()方法的重载:
const int limit = 1000;
var parameters = new string[0];
IList<Project> redmineProjects =
manager.GetObjects<Project>(limit: limit, offset: 0, include: parameters);