You are viewing limited content. For full access, please sign in.

Question

Question

CMIS Search Document by Template Fields

asked on May 22, 2019 Show version history

Hello, 

I have coded a module which could get the root folder but I got stuck at the searching and download a document stream by using field values of a LF template.

Could anyone share a .net sample for or any advise?  Thanks much.

Here is my code so far:

using PortCMIS;
using PortCMIS.Client;
using PortCMIS.Client.Impl;
using PortCMIS.Data;
using System.Collections.Generic;
using System.Net;

namespace CMISpoc.Utils
{
    static public class CMISaccess
    {

        static public void MainCMISaccess(string pCMISurl)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
            SessionFactory factory                                  = SessionFactory.NewInstance();
            Dictionary<string, string> parameters         = new Dictionary<string, string>
            {
                [SessionParameter.User]               = @"domain\svcLaserfiche_test",
                [SessionParameter.Password]       = "testPw",
                [SessionParameter.BrowserUrl]     = "http://Localhost/lfcmis/browser",
                [SessionParameter.BindingType]  = BindingType.Browser,
                [SessionParameter.RepositoryId]  = "ChplTst"
            };
            ISession session    = factory.CreateSession(parameters);
            IFolder rootFolder  = session.GetRootFolder();
        }

...

 

I guess that the key thing is constructing a CMIS query. The problem is that I keep getting error when doing search with field:name parameters.

SELECT * FROM cmis:document WHERE lf:templateName = 'MTR' AND field:PoNumber = '000576'

"exception": "invalidArgument",
    "message": "The search is not supported because of field:PoNumber."

0 0

Answer

SELECTED ANSWER
replied on June 3, 2019

Hi An,

 

Have a try with SELECT lf:fields.field:PoNumber FROM cmis:document WHERE lf:templateName = 'MTR' AND lf:fields.field:PoNumber = '000576'

 

Laserfiche fields is of secondary table in CMIS, so it should add the secondary table prefix when querying.

1 0

Replies

replied on June 4, 2019

It works beautifully. Very much appreciated! laugh

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.