Adding billable time (worked time) to an incident programatically, how to specify analyst field?
I used the following code to add an entry in Time worked (Billable time) of an incident. The code works fine for me, however the problem is that added billable time has no
Analyst property. Can anyone please help me to have this field filled by name of the person who add this entry?
ManagementPack systemMP = emg.ManagementPacks.GetManagementPack(SystemManagementPack.System);
ManagementPack incidentManagementMP = emg.ManagementPacks.GetManagementPack("System.WorkItem.Incident.Library", systemMP.KeyToken, systemMP.Version);
ManagementPack workItemManagementMP = emg.ManagementPacks.GetManagementPack("System.WorkItem.Library", systemMP.KeyToken, systemMP.Version);
ManagementPackClass billableTimeClass = emg.EntityTypes.GetClass("System.WorkItem.BillableTime", workItemManagementMP);
ManagementPackRelationship wiTobt = workItemManagementMP.GetRelationship("System.WorkItemHasBillableTime");
CreatableEnterpriseManagementObject objectBillableTime = new CreatableEnterpriseManagementObject(emg, billableTimeClass);
objectBillableTime[billableTimeClass, "Id"].Value = Guid.NewGuid().ToString();
// objectBillableTime[billableTimeClass, "DisplayName"].Value = ?
objectBillableTime[billableTimeClass, "LastUpdated"].Value = DateTime.Now;
objectBillableTime[billableTimeClass, "TimeInMinutes"].Value = 561;
emopIncident.Add(objectBillableTime, wiTobt.Target);
emopIncident.Commit();
May 20th, 2012 2:16am
Hi,
May I know if the issue is about System Center Service Manager? If so, considering it is System Center Essentials forum here, please go to the corresponding forum for help:
System Center - Service Manager Forums
http://social.technet.microsoft.com/Forums/en/category/servicemanager
Thanks for your understanding and cooperation.
Nicholas Li
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 4:02am