Here's the extension code (CSOM) for the sharepoint list
public static bool DoesFieldExist(this List list, ClientContext clientContext, string internalFieldname) { bool exists = false; clientContext.Load(list.Fields, fCol => fCol.Include( f => f.InternalName ).Where(field => field.InternalName == internalFieldname)); clientContext.ExecuteQuery(); if (list.Fields != null && list.Fields.Count > 0) { exists = true; } return exists; }
Using
List targetList = this.Context.Web.Lists.GetById(<ListID>); targetList.DoesFieldExist(<ClientContext>, <Field internal Name>)
enjoy :)
Mitya kours
source share