Use CSOM to set folder default

Hi,

I need to set Folder Defaults using the CSOM is this possible?

Paul

August 11th, 2014 11:19am

Hi,

I dont understand your requirement clearly.

Could you please provide more detailed information? It will be easier for us to find the solution.

Best regards

Free Windows Admin Tool Kit Click here and download it now
August 12th, 2014 5:45am

The following server side code will set a folder default for the root folder.

SPList list = ...

MetadataDefaults metaDefaults = new MetadataDefaults(list); metaDefaults.SetFieldDefault(list.RootFolder, "InternalFieldName", "DefaultValue");

metaDefaults.Update();

I can't find the equivalent using the CSOM.

August 12th, 2014 11:31am

Hi,

According to your description, you want to set default value for a specific field using Client Object Model.

As there is no such API in Client Object Model, I suggest you create a custom web service with Doument Mangement API to achieve your requirement.

More information how to create and call custom web service:

http://blogs.msmvps.com/windsor/2011/11/04/walkthrough-creating-a-custom-asp-net-asmx-web-service-in-sharepoint-2010/

http://msdn.microsoft.com/en-us/library/ms464040(v=office.12).aspx

Best regards,

ZhengyuGuo

Forum Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

Free Windows Admin Tool Kit Click here and download it now
August 15th, 2014 8:18am

Hi,

Thanks for your reply, this is what I suspected. The reason for the question is to migrate code that is running on the server for porting to SharePoint 2013, so creating a web service is not a solution for me. Do you know if there a way of requesting changes to the CSOM?

Paul

August 19th, 2014 8:36am

I know the thread is a bit old but i have the same issue but the problem is i am using Office 365 so I cannot use the server side object model at all.

I have nearly 100 libraries that i need to set default values for. I thought i had found a way by setting the field default against the library but this doesn't work. 

This was don by getting the Field object from the list and then updating the DefautValue property.

I can change it through the UI but this is not feasible given the number of updates i need to make. 

There must be a way. I can set field values against everything else.

Free Windows Admin Tool Kit Click here and download it now
September 24th, 2014 11:00am

This is all possible through CSOM. You need to provision a file to the hidden forms folder and attach an OOTB event receiver to the library. See the following post for a full write-up: http://sharedpointers.blogspot.nl/2015/07/configuring-metadata-defaults-with-csom.html

July 12th, 2015 11:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics