Retrieve field groups from SharePoint CSOM -



Retrieve field groups from SharePoint CSOM -

i want retrieve existing field groups (from root) , display them in dropdown list.

i'm using code retrieve columns (and display grouping they're belonging to):

var web = clientcontext.web; fieldcollection rootfields = web.fields; clientcontext.load( rootfields, fields => fields .include(field => field.group) ); clientcontext.executequery(); foreach (field _fields in rootfields) { fieldslist.add(new selectlistitem { text = _fields.group }); }

this shows few hundred groups (duplicates ofc), want narrow downwards few groups exist, , sort out duplicates. or there way this?

you can via linq:

distinct sort duplicates out of result.

var results = rootfields.tolist().select(field => field.group).distinct(); foreach (var_group in results) { fieldslist.add(new selectlistitem { text = _group }); }

sharepoint-2013 csom

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -