1. 产品
  2.   Project Management
  3.   .NET
  4.   Redmine-NET-API
 
  

免费 C# .NET 项目管理 API,用于处理 Redmine 中的项目

开源 C# .NET 库,用于与 Redmine 项目管理应用程序通信。它可自动化任务、生成有洞察力的报告或在 .NET 应用中自定义工作流。

Redmine-Net-API 是什么?

Redmine 在项目管理领域广为人知,是一款功能强大且灵活的工具。它因多功能性和强大特性而受到众多团队的青睐。为了让它更好用,开发者创建了实用的插件和库。一个例子是 GitHub 上的 Redmine‑Net‑API。该库通过提供 .NET API 扩展了 Redmine 的功能。借助它,您可以轻松将 Redmine 与 .NET 应用程序集成。该库为希望在 .NET 程序中添加 Redmine 功能的开发者提供了令人兴奋的机会。使用此库,您现在可以轻松记录任务的时间条目,帮助您保持组织有序并掌控项目任务。

Redmine‑Net‑API 是面向希望与 Redmine 服务器交互的 .NET 开发者的实用工具。由 zapadi 创建,该库让您更容易从 .NET 应用程序与 Redmine 服务器通信。它维护良好,因其用户友好的特性和丰富的功能而成为开发者的首选。通过允许您创建自定义查询和属性,该库为您提供了根据需求定制 Redmine 的灵活性。无论是设置特殊工作流、集成自定义字段,还是自动化复杂业务流程,它都是提升 Redmine 功能并简化项目管理流程的宝贵资源。凭借无缝集成、用户友好布局、广泛功能和直观 API,这个工具是让项目管理更轻松的极佳资产。它增强了 Redmine 的能力,使项目任务对您而言更加简便。

Previous Next

开始使用 Redmine‑Net‑API

推荐的 Redmine‑Net‑API 安装方式是通过 NuGet。请使用以下命令进行顺利安装。

通过 NuGet 安装 Aspose.Tasks for .NET

Install-Package redmine-net-api

您可以直接从 GitHub 页面 下载

使用 C# 在 Redmine 中创建新项目

开源 Redmine‑Net‑API 库让软件开发者能够使用 .NET API 在 Redmine 中轻松创建新项目。首先,需要使用 Redmine 服务器的 URL 和身份验证凭据初始化 RedmineManager。然后,创建一个包含所需参数的 Project 对象,并使用 CreateObject 方法将其添加到 Redmine 实例中。下面的示例展示了如何创建新项目。运行代码后,将在您的 Redmine 实例中创建一个带有指定详细信息的新项目,并在控制台输出中新创建项目的 ID。

如何使用 C# .NET API 在 Redmine 中创建新项目?

using Redmine.Net.Api;
using Redmine.Net.Api.Types;

class Program
{
    static void Main(string[] args)
    {
        // Initialize RedmineManager with server URL and API key
        var redmineManager = new RedmineManager("https://redmine.example.com", "your_api_key");

        // Create a new project object
        var newProject = new Project
        {
            Name = "New Project",                      // Set the name of the new project
            Identifier = "new-project",                // Set a unique identifier for the project
            Description = "This is a new project.",    // Set the description of the project
            IsPublic = true,                           // Set whether the project is public or private
            TrackerIds = new List { 1, 2, 3 },    // Set the tracker IDs for the project (e.g., 1 for bug, 2 for feature, 3 for support)
            IssueCustomFieldValues = new List // Set custom field values for the project, if any
            {
                new IssueCustomField { Id = 1, Value = "Custom Value 1" },
                new IssueCustomField { Id = 2, Value = "Custom Value 2" }
            }
        };

        try
        {
            // Create the new project
            Project createdProject = redmineManager.CreateObject(newProject);

            // Output the ID of the newly created project
            Console.WriteLine($"New project created with ID: {createdProject.Id}");
        }
        catch (RedmineException ex)
        {
            // Handle any errors that occur during project creation
            Console.WriteLine($"Error creating project: {ex.Message}");
        }
    }
}

通过 C# 检索 Redmine 中现有项目列表

使用开源 Redmine‑Net‑API 库在 .NET 应用程序中检索 Redmine 中现有项目列表非常直接。您需要使用 Redmine 服务器的 URL 和身份验证凭据初始化 RedmineManager,然后使用 GetObjects 方法获取项目。下面的示例演示了开发者如何显示 Redmine 实例中每个现有项目的详细信息,包括其 ID、名称、描述以及是否为公开项目。

如何通过 C# API 检索 Redmine 中现有项目列表

using Redmine.Net.Api;
using Redmine.Net.Api.Types;
using System;

class Program
{
    static void Main(string[] args)
    {
        // Initialize RedmineManager with server URL and API key
        var redmineManager = new RedmineManager("https://redmine.example.com", "your_api_key");

        try
        {
            // Retrieve a list of projects from Redmine
            var projects = redmineManager.GetObjects();

            // Output details of each project
            foreach (var project in projects)
            {
                Console.WriteLine($"Project ID: {project.Id}");
                Console.WriteLine($"Project Name: {project.Name}");
                Console.WriteLine($"Project Description: {project.Description}");
                Console.WriteLine($"Is Project Public: {project.IsPublic}");
                Console.WriteLine();
            }
        }
        catch (RedmineException ex)
        {
            // Handle any errors that occur during project retrieval
            Console.WriteLine($"Error retrieving projects: {ex.Message}");
        }
    }
}
           

面向对象设计与安全性

Redmine‑Net‑API 的优势之一在于其面向对象的设计。它将底层的 REST API 调用抽象为一组直观且易于使用的类,使其更具开发者友好性,并降低了与 Redmine 交互的复杂性。此外,库支持多种身份验证方式,确保 .NET 应用程序与 Redmine 服务器之间的安全通信。这包括 API 密钥身份验证和用户名/密码身份验证,允许开发者选择最符合其安全需求的方法。

 中国人