NewProjectDocument save as central file


Hi :slight_smile:

How can I save a document as a central file from dynamo using the NewProjectDocument method?



Found it :smile:

    wopt = WorksharingSaveAsOptions() #<--- here ;P
	wopt.SaveAsCentral = True # <--- here ;P

	sopt = SaveAsOptions()
	sopt.OverwriteExistingFile = True
	sopt.Compact = True
	sopt.SetWorksharingOptions(wopt) #<--- here ;P
	newdoc.SaveAs(path, sopt)


nice solution :wink:


If you’re working with a new project, I discovered that you have to first enable worksharing before you can use the WorksharingSaveAsOptions class.
In my script, the following lines are how got it done:

for rvt in ModProjects:
    open_file = app.OpenDocumentFile(rvt)
    open_file.EnableWorksharing("Shared Levels and Grids","Workset1")