08-09-2018 01:29 PM
Hello,
I'm trying to create a script that will pull documents based off of a custom query I have set up. The custom query itself works fine in the client, but when I try to connect to the api via a script and run the query I am getting a NullReference exception. Has anyone else ever experienced this? The Hyland.Unity.dll version is 16.0.2.83. Even the if statement errors out. Like the CustomQueries library doesn't exist in the API or something.. Do we need a special license type to accomplish this?
if(app.Core.CustomQueries != null) { try { Console.WriteLine(app.Core.CustomQueries.Count); } catch (UnityAPIException ex) { Console.Write(ex); app.Dispose(); } }
08-10-2018 06:28 AM
Speculating because there isn't enough information. Is this run outside (Unity API) or inside (Unity Automation API)? If it's outside are you connecting Session first?
Also, I could be totally off, but I don't think you can test null against app.Core.CustomQueries like that without instantiating it first.
Mind, if this is just a snippet you may have accounted for these.
09-07-2018 06:26 AM
Marcus's code is excellent and correct. That is the general structure of how a CustomQuery object is instantiated and used by the DocumentQuery class.
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.