ProjectNode.clear Method [AX 2012]

Removes the contents of a project.

public void clear()

Run On


This method does not remove the project contents from the Application Object Tree (AOT)—only from the project itself. This method removes the project contents but does not remove the project folder.

To delete a project and its contents in one method call, use the AOTdelete method. To delete objects from the AOT, use the AOTdelete method.

The following example removes any objects in the Project1 project in the Private folder.

static void clearProjectObjects(Args _args) 
        ProjectNode privatePn; 
        ProjectNode pn; 
        // Navigate to the Private projects folder. 
        privatePn = infolog.projectRootNode().AOTfindChild("Private"); 
        // Get a reference to the project. 
        pn = privatePn.AOTfindChild("Project1"); 
        // Clear the project.