0


i'm trying to fetch document from alfresco using CMIS queries and all i have is there object id i tried the following but it returned 'bad request'

SELECT * FROM cmis:document where cmis:objectId = workspace://SpacesStore/89332e83-1a43-41fe-ba8d-2facdf317d05   


I apologize i forgot to mention that i'm using CMIS with javascript Thank you .

Ayoub Idelhoussain
  • 635
  • 4
  • 9
  • 23

2 Answers2

1

When you have the ID you don't need to use a query you can get it directly from the session object.

Typically for Java you can do something like this :

CmisObject cmisObject = session.getObject(id);

if (cmisObject instanceof Document) {
    Document document = (Document) cmisObject;
} else if (cmisObject instanceof Folder) {
    Folder folder = (Folder) cmisDocument;
} 
sgirardin
  • 428
  • 5
  • 12
0

Simplly with CMIS there is two ways to get an object (File or Folder) :

Before getting the object you need to get your alfresco session, read this post : How to get Session in Alfresco using CMIS.

Getting an object by path

CmisObject object = session.getObjectByPath(pathObject);

Getting an object by ID

CmisObject object = session.getObject(idObject);

After getting the object you can cast it to File or Folder

You can also read this post to understand how to get document with query using a Folder ID How to get a document using Folder ID.

Hope that Helped you.

Community
  • 1
  • 1
Yagami Light
  • 1,756
  • 4
  • 19
  • 39