title: How do you get the UserName from UserInformationListItem in SharePoint Service Reference
body: <p>I am accessing SharePoint List data via WCF and listdata.svc</p>
  
  <p>One of my lists called Tasks has a field named 'AssignedTo'. When I loop through the list items, the AssignedTo field returns a UserInformationListItem rather than a string value.</p>
  
  <p>How do I get the username of the person to which the task is assigned? It should come from the UserInformationList, but I can't figure out how to get it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>        SpIMDLists.InformationManagementDivisionDataContext dc = new SpIMDLists.InformationManagementDivisionDataContext(new Uri("https://myurl/SiteDirectory/IMD/_vti_bin/ListData.svc/"));
  
          dc.Credentials = System.Net.CredentialCache.DefaultCredentials;
  
          var source = dc.Tasks;
  
  
          foreach (var task in source)
          {
              string taskTitle = task.Title;
              string taskDesc = task.TaskDescription;
              string taskDueDate = task.DueDate.ToString();
              string taskStartDate = task.StartDate.ToString();
              string taskStatusValue = task.StatusValue;
              string taskOutcome = task.TaskOutcome;
              string taskAssignedTo ="";
              System.Collections.ObjectModel.Collection&lt;SpIMDLists.UserInformationListItem&gt; assignedTo = task.AssignedTo;
  
  
           }
  </code></pre>