I am using the Pnp Core library 1.5.0 (https://github.com/pnp/pnpcore) trying to read a lookup value in a sharepoint list.
var listNameBookings = "Bookings";
var itemsBookings = await pnpContext.Web.Lists.GetByTitleAsync(listnameBookings, p => p.Title,
p => p.Fields.QueryProperties(p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title));
var dict = new Dictionary<string, bool>();
foreach(var d in itemsBookings.Items)
{
var Who = (string)d["Who"];
var When = (DateTime)d["When"];
var Where = ((IFieldLookupValue)d["Where"]).LookupValue; // ERROR
dict[Where] = true;
}
But I get an error when the execution reaches the lookup line:
'((IFieldLookupValue)d["Where"]).LookupValue' threw an exception of type 'PnP.Core.ClientException'
In details Property LookupValue was not yet loaded
Someone knows how to read it?
Thanks you