question

LoveToCode-0935 avatar image
0 Votes"
LoveToCode-0935 asked LoveToCode-0935 edited

IdentityRef in Vb.net

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") 
dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LoveToCode-0935 avatar image
1 Vote"
LoveToCode-0935 answered LoveToCode-0935 edited

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



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.