cancel
Showing results for 
Search instead for 
Did you mean: 

not able to create folder using CMIS API

nancyaggarwal
Champ in-the-making
Champ in-the-making
Hi,

I am building one client application which is integrated with alfresco using external authentication. I am able to create a session with alfresco using current user alf_ticket. Now in root folder i have created one folder with the name "test".

Now i want to create folder inside the folder test with the name of the current user.

For this i written the below code:

private static Folder createFolder(Folder target, String newFolderName) {
      Map<String, String> props = new HashMap<String, String>();
      props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
      props.put(PropertyIds.NAME, "abc");
      Folder newFolder = target.createFolder(props);
      return newFolder;
   }


and now calling this method in main after retriving the test as below:
Folder target = (Folder) session.getObject("workspace://SpacesStore/898583d0-5c38-4dad-a297-204f45960a4c"); //retrieving test folder
               Folder newFolder = createFolder(target, "abc");


but while running this code this is giving me org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException: Forbidden error.


Please help me with this.


Regards,
Nancy
2 REPLIES 2

rahulmackdani
Champ in-the-making
Champ in-the-making
Hi Nancy

There are 2 possible reasons for above error

1)User does not have right to create content inside folder

Can you check whether you can create folder using the user through UI

2)Alfresco Ticket might have expired

Hi Rahul,

Thanks for your reply.

No i am not able to create folder using the user through UI.

I am logged in with non-admin user and i think that user does not have permission for creating the folder in repository.

So, can you help me how can in set permission for the user without loading application context in my java class.


Nancy
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.