cancel
Showing results for 
Search instead for 
Did you mean: 

How to create subfolder in alfresco ?

taskinbinbir
Champ in-the-making
Champ in-the-making

How to create subfolder in alfresco ?

6 REPLIES 6

mehe
Elite Collaborator
Elite Collaborator

in which context? In share just go to a folder and create a now folder in it....

taskinbinbir
Champ in-the-making
Champ in-the-making
private static void createProjectToMasterSite(String masterSiteId, List<String> projectId,List<String> projectName) {
    String apiurl = api+"alfresco/service/api/site/folder/"+ masterSiteId +"/documentLibrary";
    for(int i =0 ;i<projectName.size();i++)
    {
        String pjId=projectId.get(i);
        String pjName=projectName.get(i);
            System.out.println(pjId + " " + pjName);
            JsonObject obj = new JsonObject();
            obj.addProperty("name", pjId);
            obj.addProperty("title",pjName);
            obj.addProperty("nodeType", "cm:folder");
            post(apiurl, obj, "createProjectToMasterSite()");
            getMembersToFolder(masterSiteId, pjId);
            inheritPermissionProject(projectId.get(i), masterSiteId);
          //  createProjectFolder(masterSiteId, pjId);
    }
}

private static void createProjectSubFoldertoFolder(String masterSiteId,String projeId,String folderName,String[] subFolderName) {
    for(int i = 0; i< subFolderName.length; i++) {
        String sub_folder_name = subFolderName[i];
        String apiurl = api + "alfresco/service/api/site/folder/" + masterSiteId + "/documentLibrary/" + projeId+"/"+folderName;
        JsonObject obj = new JsonObject();
        obj.addProperty("name", sub_folder_name);
        obj.addProperty("nodeType", "cm:folder");
        post(apiurl, obj, "createProjectSubFoldertoFolder");

    }
}

I hope helpful.

mehe
Elite Collaborator
Elite Collaborator

ever looked into the examples on the github repo of Jeff Potts‌ ? jpotts (Jeff Potts) · GitHub 

Or use CMIS or the new Rest-API Alfresco Content Services REST API Explorer 

taskinbinbir
Champ in-the-making
Champ in-the-making

Thanks!

mehe
Elite Collaborator
Elite Collaborator

in the new Rest API you can use "createNode" with the relativePath (JSON) property... it will create the whole tree for you if any folders are missing

taskinbinbir
Champ in-the-making
Champ in-the-making

I didn't know. Thanks! When did this feature come in ?