I have the following code:
rev2.AcceptAllRevisions();
var trackedChanges = rev2.Revisions;
_logger.Info("Tracked change count: " + trackedChanges.Count);
This usually works as expected, but in one case it didn't. The logs show:
Tracked change count: 1
The document concerned has a tracked change saying
Formatted: Normal, no bullets or numbering.
Why did Document.AcceptAllRevisions() not clear that revision? How do I prevent it leaving revisions in place in future?
Iterating through the revisions and accepting them individually worked in the case where the revision was not affected by AcceptAllRevisions()
i.e.:
var trackedChanges = rev2.Revisions;
for (var i = 1; i <= trackedChanges.Count; i++)
{
var trackedChange = trackedChanges[i];
trackedChange.Accept();
}