I am interating over SharePoint Fields to examine the Hidden Property (Sytem.Boolean) so it can be toggled. I am noticing that the GetValue(f,null) is always True even when I know the field Hidden property is False. I don't see why it keeps returning true. Thanks
var list = ctx.Web.Lists.GetById(libGuid);
var fields = list.Fields;
ctx.Load(list);
ctx.Load(fields);
ctx.ExecuteQuery();
List<object> fieldPropList = new List<object>();
foreach (Field f in fields)
{
List<PropertyInfo> props = f.GetType().GetProperties().ToList();
foreach (var prop in props)
{
if (prop.Name == "Hidden")
{
fieldPropList.Add(new
{
PropertyName = prop.Name,
PropertyType = prop.PropertyType.ToString(),
CanRead = prop.CanRead,
CanWrite = prop.CanWrite,
Value = prop.GetValue(f, null).ToString() // Always TRUE why?
});
}
}