3

So I am trying to update a Task and change the User Story it belongs to. This is what i am trying..

var toUpdate = new DynamicJsonObject();

// the new User Story
toUpdate["WorkProduct"] = "/hierarchicalrequirement/4567890123";

// the ObjectID of the Task
long oid = 45678912445; 

OperationResult result = _restApi.Update("task", oid, toUpdate);

But getting this error: System.Collections.Generic.List'1[System.String]

5
  • I put together a little example to reproduce what you are doing and it worked just fine. Do you have the full stack trace of your error? What version of the Rally REST API for .NET are you using? (The most recent version is 1.04)
    – Kyle Morse
    Commented Nov 11, 2011 at 20:14
  • Hey Kyle, that error is from result.Errors of the OperationResult, so not sure how to get more information
    – robnardo
    Commented Nov 11, 2011 at 20:19
  • It must have been some string error that i overlooked. It is working now. thanks for checking!
    – robnardo
    Commented Nov 11, 2011 at 20:36
  • 1
    @robnardo, Post what you did to fix it and accept it as the answer.
    – user47589
    Commented Nov 11, 2011 at 22:02
  • This was a defect that has been fixed in versions 1.06 of the library.
    – Kyle Morse
    Commented May 11, 2012 at 13:32

1 Answer 1

0

This is what I got to work prior to any bug fixes reported by Kyle Morse..

public string ProxyUpdateTask(Task myTask, string strWorkProduct)
    {

        var message = @"<span style=""color:green;"">SUCCESS</span>";
        const string errPrefix = @"<span style=""color:red;"">ERROR</span>";

        var toUpdate = new DynamicJsonObject();

        long oid;
        Int64.TryParse(myTask.ObjectId, out oid);

        toUpdate["WorkProduct"] = String.Format("/hierarchicalrequirement/{0}", myTask.UserStoryId);


        try
        {
            var result = _restApi.Update("task", oid, toUpdate);
            if (!result.Success) 
                message = String.Format(@" {2} updating (ObjectID={0}) failed. {1}", myTask.ObjectId, result.Errors, errPrefix);
        }
        catch (WebException ex)
        {
            message = String.Format(" {0} - {1}", errPrefix, ex.Message);
        }
        catch (Exception ex)
        {
            message = String.Format(" {0} - {1}", errPrefix, ex.Message);
        }

        return message;

    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.