So basically you need to check if an Element is still "Borrowed" in the central model. I'm not aware of an API method you can call for all elements in one go. You'll need to open a (new) local file and check for each element your self.
private bool AreAllElementsRelinquished(Document doc) { WorksetTable table = doc.GetWorksetTable(); IList<WorksetPreview> wInfo = WorksharingUtils.GetUserWorksetInfo(doc.GetWorksharingCentralModelPath()); foreach(WorksetPreview info in wInfo) { if (!string.IsNullOrWhiteSpace( info.Owner)) return false; } IEnumerable<Element> types = new FilteredElementCollector(doc) .WhereElementIsElementType(); foreach(Element e in types) { CheckoutStatus st = WorksharingUtils.GetCheckoutStatus(doc,e.Id); if(st != CheckoutStatus.NotOwned) return false; } IEnumerable<Element> elems = new FilteredElementCollector(doc) .WhereElementIsNotElementType(); foreach(Element e in elems) { CheckoutStatus st = WorksharingUtils.GetCheckoutStatus(doc,e.Id); if(st != CheckoutStatus.NotOwned) return false; } return true; }