1

I want to modify a lot of files in SharePoint programmatically, but it's important to not create a new version. When versioning is turned off for a list, this is easy to do using

file.CheckOunt();
file.SaveBinary(/*data*/);
file.CheckIn(file.CheckInComment, SPCheckinType.OverwriteCheckIn);

But when versioning is turned on, and the current version is published, this does not work and gives the following error message instead:

You cannot checkin and overwrite a published file.

Is there a way to override a file without changing version, that works in every situation?

There reason why I need this is the following: My program makes the files smaller while keeping their format and their visual content. It uses compression strategies that are built into the format to achieve the smallest possible size. So, the goal is to save space. But when I create a new version with the smaller file instead of the existing one, this would not make any sense at all.

1 Answer 1

0

No, it's not possible to make the changes without increasing the version number in all SharePoint versions,

As a workaround solution Try to delete the higher versions until reach to the desired version-1 then make the desired changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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