0

I want to get the CmisDocument of this CMIS remote file: server1/dir1/file1.

I already have the CmisFolder for server1/dir1.
I also have the filename "file1" as a string.

Any elegant way to get the CmisDocument?

Below is my very inelegant attempt:

IDocument document = null;
foreach(ICmisObject obj in remoteFolder.GetChildren())
{
    if (obj is IDocument)
    {
        document = (IDocument)obj;
        if (document.Name.Equals(fileName))
        {
            break;
        }
    }
}
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373

1 Answers1

0

You could try using a query:

string statement = "select * from cmis:document where cmis:contentStreamFileName = 'filename' and in_folder('myfolderid')"; 

IItemEnumerable<IQueryResult> qr = session.Query(statement, true);

You can also change cmis:document to the specific table/class that contains your document to make your query a little faster.

Nic
  • 151
  • 1
  • 2
  • 9