cancel
Showing results for 
Search instead for 
Did you mean: 

Can I Nest a DocumentQuery within a FolderQuery?

Diane_Wagner_Sm
Confirmed Champ
Confirmed Champ

I have queried to get a particular folder by the folder keyword (policy number) successfully.

Now that I have the folder I would like to query for specific documents within that folder.

Is that possible?

Thanks,

Diane Asberry

 

5 REPLIES 5

Nathan_Kossover
Star Contributor
Star Contributor

Hi Diane -

If you have the Folder object, you can call GetDocuments() off of it to retrieve all the Documents in the folder. For details, see the SDK article at:

Home / Unity API / Reference / Hyland.Unity Namespace / Folder Class / Folder Methods / GetDocuments Method

Currently you cannot retrieve a subset of the Documents within a Folder. You are limited to retrieving all of the Documents. If you want to filter them further you'll have to do that by filtering against the contents of the DocumentList that is returned from Folder.GetDocuments().

Does this help?

Nathan

Scott_McLean
Elite Collaborator
Elite Collaborator

Hi Diane,

The Folder.GetDocuments() method returns a DocumentList representing the documents for that folder. You should be able to traverse that list to find the documents you want more quickly than you would execute a DocumentQuery, and since you've already got the list itself, you're not expending a query every time you search for a subset of documents.

For example:

var oFolderDocuments = oFolder.GetDocuments(1000);
foreach (var oDoc in  oFolderDocuments.where(odDoc => odDoc.DocumentType.Name == "My Search Doc Type")) {
    // ... Do something with the selected documents
}

Of course, you could do the same thing with document dates, rendition file types, or whatever your search criteria are.

Kind regards,

-Scott

Diane_Wagner_Sm
Confirmed Champ
Confirmed Champ

Thanks.  Not the answer I was hoping for.

The suggestion you made about retrieving all the documents and then filtering against the list is the approach that I took.

I was just hoping for the possibility of a nested query making the process more efficient and cleaner.

Thanks again

Diane Asberry

 

Jeff_Stoner
Elite Collaborator
Elite Collaborator

Hi Diane -

If the subset of documents remains constant from query to query (i.e. always requesting the same set of doc types) then one option would be to create a separate folder that contains the specific documents for use by the API.

Regards,
-jeff