Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Project Class / UpdateProjectStructure Method
Example
In This Topic
    UpdateProjectStructure Method
    In This Topic
    Update project structure of this project to show the current state of structure of documents.
    Syntax
    public void UpdateProjectStructure()
    Remarks

    This method is useful only from plugins.

    Use together with the silent manipulation with documents.

    Example
    This example shows the case when is useful to call this method.
    // HpD API plugin invoked from Project page:
    
    Project project = api.CurrentProject ?? throw new Exception();
    
    // Create new variant in the silent mode.
    Variant variant = project.CreateVariant("NewVariant", silent: true);
    
    // The new variant is not shown in the project structure for now.
    
    // Creating multiple documents at once without refreshing project structure after each document:
    // Set the variant to the silent mode (or open it in the silent mode).
    variant.SilentMode = true;
    					
    // Create documents.
    for (int i = 0; i < 50; i++)
    {
    	variant.CreateWorkspace($"Workspace{i}");
    }
    					
    // There is still no new document shown in project structure in UI.
    					
    // Refresh the project structure only once at the end.
    project.UpdateProjectStructure();
    					
    // New variant and all its new documents are shown in the project structure now.
    See Also