I am working on an application where I create folders using Microsoft.Sharepoint.Client.ClientContext (CSOM) inside a list item and sub folders to. I want to set the default column value for some fields to the newly created folder so the sub folder inherit the value from its direct parent. any help? In short how to set default column value for specific location(folder) in C#?
Here is a very nice example for setting default values for list items. The example is for 2010, but it is also applicable for SharePoint 2013 and Online:
ClientContext clientContext = new ClientContext(siteUrl); Web web = clientContext.Web; List list = web.Lists.GetByTitle("CustomList"); Field field = list.Fields.GetByTitle("Title"); field.DefaultValue = "Default"; field.Update(); clientContext.Load(field); clientContext.ExecuteQuery();
On re-reading your question, I am no longer sure if that is what you meant... Did you mean something along the lines of this? Could you post what you have already tried and what is not working for you?