Hi,
I have an external list with a DateTime field on. I want to access the field properties such as DisplayFormat, DefaultValue etc on the field. I understand that some of these will be null as they come from an external source but I cannot even access the properties by loading them from the context:
FieldDateTime dateTime = myExtlist.Fields[4] as FieldDateTime; if (dateTime != null) { ctx.Load(dateTime, dt => dt.DateTimeCalendarType, dt=> dt.DisplayFormat, dt => dt.FriendlyDisplayFormat); ctx.ExecuteQuery(); }
I am getting the exception: Invalid field name. {00000000-0000-0000-0000-000000000000} /sites/FieldTest/Lists/myExtList
Using a different approach, I can access the more generic field properties by doing this:
ctx.Load(myExtList,l => l.Title, l => l.Fields.Include( f => f.Id, f => f.Title, f => f.TypeAsString, f => f.DefaultValue, f => f.Description, f => f.EnforceUniqueValues, f => f.FieldTypeKind, f => f.FromBaseType, f => f.Group, f => f.Hidden, f => f.ReadOnlyField, f => f.Required, f => f.Scope, f => f.Sealed, f => f.InternalName, f => f.StaticName, f => f.SchemaXml));
My propblem is, I need to get the field-specific properties. DateTime is one example but, for instance, Number fields will have min and max values etc which I won't reach either using the generic approach.
Has anyone done this before?
Thanks
Mike