- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 93
Update a redmine object
        Padi edited this page Oct 13, 2020 
        ·
        10 revisions
      
    When trying to update an object with invalid or missing attribute parameters, you will get RedmineException that contains the corresponding error messages.
Sync Example (Issue):
using System;
using System.Collections.Specialized;
using Redmine.Net.Api;
using Redmine.Net.Api.Types;
namespace RedmineTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string host = "<host>";
            string apiKey = "<api-key>";
            string issueId = "<issue-id>";
            var manager = new RedmineManager(host, apiKey);
            var issue = manager.GetObject<Issue>(issueId, null);
            issue.Description = "Updated description"; 
            manager.UpdateObject(issueId ,issue);
            var updatedIssue = manager.GetObject<Issue>(issueId, null);
            Console.WriteLine("Updated issue: {0}.", updatedIssue);
        }
    }
}
Async Example (Issue):
using System;
using System.Collections.Specialized;
using Redmine.Net.Api;
using Redmine.Net.Api.Types;
using Redmine.Net.Api.Async;
using System.Threading.Tasks;
namespace RedmineTest
{
    class Program
    {
        static RedmineManager manager;
        static async Task Main(string[] args)
        {
            string host = "<host>";
            string apiKey = "<api-key>";
            string issueId = "<issue-id>";
            manager = new RedmineManager(host, apiKey);
            var updatedIssue = await UpdateAsync(); 
            Console.WriteLine("Updated issue: {0}.", updatedIssue);
        }
        private static async Task<Issue> UpdateAsync()
        {
            var issue = await manager.GetObjectAsync<Issue>(issueId, null);
            issue.Description = "Updated description"; 
            await manager.UpdateObjectAsync(issueId ,issue);
            return await manager.GetObjectAsync<Issue>(issueId, null);
        }
    }
}
- 
CRUD Operations 
- 
List Operations 
- 
Specific operations - Attachments
- Issues
- Users
- Groups
- Wiki pages