- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
we have a piece if code, that's running fine on every machine that we tested it on, but on some user's PC it will always throw a CorruptModelException with this message: "The model could not be saved: Unbekannter Fehler beim Zugriff auf eine unbenannte Datei. (CArchiveException 1)"
(translation of the german part: unknown error while accessing an unnamed file)
This error seems to be impossible to reproduce on my system.
Heres the failing code. I believe, the Exception is thrown in the last line.
...
Document doc = null;
if (docTemplatePath.EndsWith(".rte"))
doc = app.Application.NewProjectDocument(docTemplatePath);
else
doc = app.Application.OpenDocumentFile(docTemplatePath);
SaveAsOptions saveAsOptions = new SaveAsOptions();
saveAsOptions.OverwriteExistingFile = true;
if (activateWorksharing != null && activateWorksharing == "true")
{
doc.EnableWorksharing(WWBRevitApp.resourceManager.GetString("WWBRevitEventHandler_WorksetName"), WWBRevitApp.resourceManager.GetString("WWBRevitEventHandler_WorksetNameGridLevel"));
WorksharingSaveAsOptions worksharingSaveAsOptions = new WorksharingSaveAsOptions();
worksharingSaveAsOptions.SaveAsCentral = true;
worksharingSaveAsOptions.OpenWorksetsDefault = SimpleWorksetConfiguration.AllWorksets;
saveAsOptions.SetWorksharingOptions(worksharingSaveAsOptions);
}
doc.SaveAs(docCreateNewPath, saveAsOptions);
I assumed, that maybe the user passes a path, he doesn't have write access on, but the exception seems to be thrown no matter what path he uses. The .rte file he uses seems to be ok as well. As I said, the code would run fine on my machine using the same template file. If he creates a new project with that template file manually, everything is fine as well.
I'm kinda out of ideas, what the problem might be. Anybody seen this error before?
Thanks,
Andreas
Solved! Go to Solution.