I want to get data from a list. It contains some lookup fields. My problem is how to get lookup value from the list. I meant I want to expand lookup field values.
Here is the code I'm doing.
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
using (var clientContext = spContext.CreateUserClientContextForSPHost())
{
CamlQuery caml = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection libraryTagsItems = clientContext.Web.Lists.GetByTitle("Library Tags").GetItems(caml);
var requestItems = clientContext.Web.Lists.GetByTitle("Requests").GetItems(caml);
clientContext.Load(requestItems);
clientContext.ExecuteQuery();
var requestList = requestItems.Select(item => new DashboardRequest()
{
Id = Convert.ToInt32(item["ID"].ToString()),
BatchName = item["BatchName"].ToString(),
Facility = item["Facility"].ToString(),
Library = item["Library"],
}).ToList();
return requestList ;
}
Library is a lookup field. Please tell me how to get the lookupvield value in a string format.