Enable Content Approval in SharePoint using CSOM

The example in this topic show how to use CSOM to Enable Content Approval in SharePoint

  • using Microsoft.SharePoint.Client;
  • using (ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"))
  • {
  • // clientcontext.Web.Lists.GetById - This option also can be used to get the list using List GUID
  • // This value is NOT List internal name
  • List targetList = clientContext.Web.Lists.GetByTitle("a b");
  • clientContext.Load(targetList);
  • // Specify whether new items or changes to existing items should remain in a draft state until they have been approved
  • // NOTE: If you require content approval for a list or library that already contains items, all of the items in the library are marked Approved.
  • // After Enabling this, "Draft Item Security" option will also get enabled, later you can specify the option
  • targetList.EnableModeration = true;
  • targetList.Update();
  • clientContext.ExecuteQuery();
  • }

Thank you for reading this article. This code was tested in SharePoint 2013

We value your feedback:

Page URL:







© 2019 Code SharePoint