Share via

IdentityRef in Vb.net

LoveToCode 161 Reputation points
2021-04-21T10:46:34.05+00:00

Hi, I'm trying to display the System.CreatedBy fields below is my code: I tried to print in the debug mode but I couldn't get it. I have got all items in a List - Just want to get the Displayname of the user.

            Dim IdRef As New IdentityRef
            IdRef.Displayname = workitem(0).Fields.Values("System.CreatedBy") 
Developer technologies | VB
0 comments No comments

1 answer

Sort by: Most helpful
  1. LoveToCode 161 Reputation points
    2021-04-21T11:28:10.363+00:00

    Figured it out - below is the code which is working for me. Hope this benefits

          /*workitems is a list of workitems */
    
           For each wfield in workitems   
                Dim IdRef As New IdentityRef
                IdRef = workitem(0).Fields("System.CreatedBy")
                idref.DisplayName = nameonly         /*'  displays only the name of the user */
                idref.Uniquename = emailoftheuser   /*' displays the email of the user. */
    
               /*'Similarly to get the System.AssignedTo field - I used the following: */
                Dim IdAssigned to as new IdentityRef
    
                If wfield.Fields.ContainsKey("System.AssignedTo") Then
                    IdAssignedTo = wfld.Fields("System.AssignedTo")
                    LstWIT.Items(lstitem).SubItems.Add(IdAssignedTo.DisplayName & "/  " & IdAssignedTo.UniqueName)
    
     Next wfield
    

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.