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#?
1 Answer
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();
EDIT
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?
-
I want to achieve this functionality but I am using Client Object Model (Microsoft.Sharepoint.Client.dll) not Server Object Model. Aug 19, 2016 at 4:40