2024 Method
Changes 0
M

Document.HasAllChangesFromCentral

Description:
Returns whether the model in the current session is up to date with central.
public bool HasAllChangesFromCentral()
bool True means up to date; false means out of date. If central is locked but Revit can determine that the model in the current session is out of date without opening central, this method will return false instead of throwing CentralModelContentionException.
void ReloadDocument(Document doc)
{
    ReloadLatestOptions reloadOpts = new ReloadLatestOptions();
    try
    {
        doc.ReloadLatest(reloadOpts);
        // Check to make sure no new changes were synced with Central during reload
        if (doc.HasAllChangesFromCentral() == false)
        {
            // If there are changes from central, reload again
            doc.ReloadLatest(reloadOpts);
        }
    }
    catch (Exception e)
    {
        TaskDialog.Show("Reload Failed", e.Message);
    }
}