cancel
Showing results for 
Search instead for 
Did you mean: 

create folder

enkidu
Champ in-the-making
Champ in-the-making
hi mates.. im stuck trying to create a folder..


      NodeRef folder = new NodeRef("PATH:/app:company_home/app:sites");
      fileFolderService.create(folder, "asdf", ContentModel.TYPE_FOLDER);


error message: 11020024 Invalid store ref: Does not contain :// PATH:/app:company_home

asdf is the folder which im trying to create
6 REPLIES 6

mrogers
Star Contributor
Star Contributor
Your NodeRef is nonsense.    NodeRefs look like workspace://SpacesStore/1234 in String format where workspace is the protocol,  SpeaceStore is the Store and ID is the numeric node id.

You need to obtain the node ref of the folder before calling create,  either by search or some other lookup method. 

enkidu
Champ in-the-making
Champ in-the-making
thnx for ur reply.. sorry i have no clue how to create a folder with alfresco api.. thats why that line of code looks like crap..

can u link to a page where it is described in detail.. guess this couldnt be such a big deal if u create a folder once.

this worked but it creates a folder where i dont want it:

   @Override
   protected void executeImpl(Action uAction, NodeRef uNodeRef) {
      // TODO Auto-generated method stub              
         fileFolderService.create(uNodeRef, "asdf", ContentModel.TYPE_FOLDER);
         }


yogeshpj
Star Contributor
Star Contributor

enkidu
Champ in-the-making
Champ in-the-making
thnx for ur reply.. i found this: https://forums.alfresco.com/forum/developer-discussions/repository-services/get-company-home-noderef...

it worked for me to create folders at company home.. can someone tell me how the query string have to look like to get a noderef for sites in company_home???



StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home");
NodeRef companyHomeNodeRef = null;
try
{
    if (rs.length() == 0)
    {
        throw new AlfrescoRuntimeException("Didn't find Company Home");
    }
    companyHomeNodeRef = rs.getNodeRef(0);
}
finally
{
    rs.close();
}



ok i got it.. the query has to look like this:


      ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home/st:sites");

kaynezhang
World-Class Innovator
World-Class Innovator

/app:company_home/st:sites/cm:${SITE_SHORT_NAME}

enkidu
Champ in-the-making
Champ in-the-making
thnk u all for ur help..