I am using the SharePoint CSOM with a C# desktop application and am trying to check-in a file to a document library that has the "Require check out" setting enabled. I want the modified timestamp to stay the same (not updated).
After the check-in, I update the list item with the original timestamp. This works when "Require check out" is disabled, but when it is enabled, I get an exception that says the file must be checked out first. I have tried updating the list item before the check-in, but it gets overwritten when the check-in occurs.
Is there any way to do this?
After you use SystemUpdate to update the data, have you tried OverwriteCheckin when you're checking the
SPFile
back in?Edit: After you clarified you're not working with drafts, I recommend you use
SPFile.UndoCheckOut()
to discard the checkout programmatically. Otherwise you're inherently going against the design of SharePoint by modifying content without marking the content as modified.