How to create an index in a SharePoint list Item using CSOM?

Hi Fellow SharePointers,

Below is the code snippet to create an index in a sharepoint list item in office 365 environment using CSOM.

ClientContext Cx =
new ClientContext(“http://myurl”);
List list = Cx.Web.Lists.GetByTitle(“Employee”);
Cx.Load(list);
Cx.ExecuteQuery();
Field field = list .Fields.GetByTitle(“Employee ID”);
field.Indexed = true;
field.Update();
Cx.ExecuteQuery();

Hope it helps!! Happy SharePointing Folks!!!

Leave a Reply

Your email address will not be published. Required fields are marked *