Thank you for your response,
1/ i have modified the query in order to return the field "Assigned To" as shown below :
/// <summary>
/// The <c>SysVersionControlWorkItemProviderTFS</c> class allows for TFS work items to be associated
/// with a Version Control System (VCS) check-in.
/// </summary>
// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
public class SysVersionControlWorkItemProviderTFS implements SysVersionControlWorkItemProvider
{
Microsoft.Dynamics.AX.Framework.TeamFoundationServerFacade.WorkItemStoreProxy workItemStoreProxy;
Microsoft.Dynamics.AX.Framework.TeamFoundationServerFacade.WorkItemProxyCollection workItemsCache;
#define.AssignedToMeQuery("SELECT [System.Id], [System.Title], [System.State], [System.WorkItemType], [System.AssignedTo] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.AssignedTo] = @me ORDER BY [System.Id]")
}
2/ My problem is how to get CurrentUser from WorkItem!!!!!, for example when i affect a string("CurrentUser") to Target.AssignedTo it appears in the form.
Question: WorkItem has methods to get title, id, i want to know if there is a way to add another methode get_assignedTo ??
code bellow :
private void insertWorkItemToTable(
SysVersionControlTmpWorkItems target,
Microsoft.Dynamics.AX.Framework.TeamFoundationServerFacade.WorkItemProxy workItem)
{
int id;
str title;
System.Type clrWorkItemType;
int instanceFlag = CLRInterop::getAnyTypeForObject(System.Reflection.BindingFlags::Instance);
int publicFlag = CLRInterop::getAnyTypeForObject(System.Reflection.BindingFlags::Public);
int combinedFlag = instanceFlag | publicFlag;
System.Reflection.BindingFlags propertyReflectFlags;
System.Reflection.PropertyInfo propInfo;
anytype propertyValue;
CLRObject clrPropertyValue;
System.Object nullIndex;
id = workItem.get_Id();
title = workItem.get_Title();
target.AssignedTo = "CurrentUser"; // the current user should be retreived from workItem
target.ID = id;
target.Title = title;
clrWorkItemType = workItem.GetType();
if (clrWorkItemType != null)
{
propertyReflectFlags = System.Reflection.BindingFlags::Default;
propertyReflectFlags = System.Enum::ToObject(propertyReflectFlags.GetType(), combinedFlag);
// BP Deviation Documented
nullIndex = new System.Object[0]();
propInfo = clrWorkItemType.GetProperty('State', propertyReflectFlags);
if (propInfo != null && propInfo.get_CanRead())
{
clrPropertyValue = propInfo.GetValue(workItem, nullIndex);
PropertyValue = CLRInterop::getAnyTypeForObject(clrPropertyValue);
target.State = any2str(propertyValue);
}
propInfo = clrWorkItemType.GetProperty('WorkItemType', propertyReflectFlags);
if (propInfo != null && propInfo.get_CanRead())
{
clrPropertyValue = propInfo.GetValue(workItem, nullIndex);
PropertyValue = CLRInterop::getAnyTypeForObject(clrPropertyValue);
target.Type = any2str(propertyValue);
}
}
target.insert();
if (workItemsCache.GetById(id) == null)
{
workItemsCache.Add(workItem);
}
}