1

Is it possible to create a custom field/property like the 'description' field using CSOM. I can see how fields can be added and updated per list item but not for the list itself.

I was hoping to add a hidden property/field and be able to update this like the 'description' field

Thanks in advance

1

To set such a hidden property/field , you can use property bag. It can only be accessed via code and works like a key value pair.

To set property bag using CSOM, try below code:

List customList = context.Web.Lists.GetByTitle("CustomList");
PropertyValues listAllProperties = customList.RootFolder.Properties;
listAllProperties["SecretDescription"] = "Name of Dan Brown's upcoming novel is ...";
customList.RootFolder.Update();
context.ExecuteQuery();

To retrieve it, you can use below code:

List customList = context.Web.Lists.GetByTitle("CustomList");
context.Load(customList, l => l.RootFolder.Properties);
context.ExecuteQuery();
var keyValue = customList.RootFolder.Properties["SecretDescription"];

Reference - Add meta properties to list

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.