SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
publishingWeb.PagesList.EnableModeration = false;
publishingWeb.PagesList.EnableVersioning = true;
publishingWeb.PagesList.MajorVersionLimit = 10;
publishingWeb.PagesList.EnableMinorVersions = false;
publishingWeb.PagesList.ForceCheckout = false;

While debugging, I can see that PagesList is taking my changes on the publishing site I'm targeting, but once Update() is called, the changes revert back to their former values.

My code is running as administrator with access to change the list. Elsewhere in my code I'm able to change other things, such as the quicklaunch navigation properties.

I'm testing this piece of code from a console app now, but it's not working within a stapled feature scoped at the farm level and stapled to a publishing site.

share|improve this question
up vote 3 down vote accepted

This could be a case where the handle to the list is recreated with each call which would explain why the changes are not persisting.

Try this instead :

SPList pagesList = publishingWeb.PagesList;
pagesList.EnableModeration = false;
pagesList.EnableVersioning = true;
pagesList.MajorVersionLimit = 10;
pagesList.EnableMinorVersions = false;
pagesList.ForceCheckout = false;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.