0

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

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. – Hammad Ali Aug 19 '16 at 4:40

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.