I created a small application used for tracking cases assigned to me (this is a personal project used only by me), and recently I have added the ability to reactivate cases. The problem is when I reactivate a case it is still assigned to me, I know I can pass the ixPersonAssignedTo or sPersonAssignedTo but I don't know who it is since I only pull down case number and title.
Will I have to pull down more information before reactivating the case to determine the resolver, or is there a special argument I can pass to reactivate the case back to the resolver?
The application is written in C# and uses the XML API.
Here is the code I'm hoping to use to work around this.
public static string[] ReactivateCases(string username, string password, string url, Dictionary<string, string> cases)
{
System.Collections.Generic.List<string> errors = new System.Collections.Generic.List<string>();
UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi fb = new UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi();
UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi.Url = url;
try{
fb.Login(username,password);
}catch(System.Exception){
throw new LogonFailedException("Logon Failed while getting cases");
}
foreach(KeyValuePair<string,string> _case in cases)
{
System.Collections.Generic.Dictionary<string, string> args = new System.Collections.Generic.Dictionary<string, string>();
args.Add("ixBug", _case.Key);
args.Add("sEvent", _case.Value);
args.Add("ixPersonAssignedTo",GetCaseResolver(_case.Key,fb));
try{
fb.Cmd("reactivate",args);
}catch(System.Exception ex){
errors.Add("Case " + _case.Key + ": " + ex.Message);
}
}
fb.Logout();
return errors.ToArray();
}
public static string GetCaseResolver(string casenumber, UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi fb)
{
XmlNodeList nodes = fb.XSearch("ixBug:\"" + casenumber + "\"","ixPersonResolvedBy");
XmlNode node = nodes.Item(0);
return node.InnerText;
}