0

I have a SP 2013 document library with content approval and versioning enabled. Now through a console application I am disabling the content approval and versioning to updated the document and after the document gets updated, again enabling the content approval and versioning for the library. Now if I see the document the version has been incremented.

So, how could I update the document without changing the version of the document programattically. Please help me on this. Thanks in advance!

0

Use SPListItem.SystemUpdate to update a ListItem while not modifying the author or editor. If you pass false no new version will be created.

Do not change the approval- or version-settings on the list. Leave them as is.

|improve this answer|||||
  • thanks, @Gaurravs I was in a bit of a hurry. I re-phrased the answer. – Nils Jun 18 '19 at 12:56
  • okay. Removed comment – Gaurravs Jun 18 '19 at 12:57
  • I have this already in my code. But still I can see the version is incremented. For example. I created one draft version 0.1 with doc name as abc.docx. Now when I run my console , I can see the code has updated the doc file as well as the version is upgraded to 1.0 and the Status of the document is Approved. – Kailash Sahoo Jun 18 '19 at 13:36
  • Are you still disable versions/approval? I can see the same behaviour when I disable versions, update, then re-enable versions. Do not do that. Simply call item.SystemUpdate(false) – Nils Jun 18 '19 at 13:54

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.