Plumtree EDK (Enterprise Web Development Kit) 5.4.0 |

# IDocumentManager.QueryFolders Method

Queries for document folders contained in the specified document folder, and returns an array of `IDocumentFolder`s that satisfies the query filter.

IDocumentFolder[] QueryFolders(
IDocumentFolder folder,
IDocumentFolderFilter queryfilter
);

#### Parameters

folder
  The document folder to query from. The query will be restricted to document folders contained in the given folder. Cannot be `null`.
queryfilter
  An `IDocumentFolderFilter` instance specifying which query to perform, the desired sort order of the query result, and the maximum number of rows to return. Cannot be `null`.

#### Return Value

An array of `IDocumentFolders`s satisfying the filter, in the specified document folder.

#### Remarks

To return all document folders in a project, get the top level document folder for the project using `GetTopLevelFolder`, then use this method to query the top level document folder for all the document folders it contains.

The following sample code demonstrates how to query for document folders in a project.

    //Create a new query filter
    IDocumentFolderFilter filter = documentManager.CreateDocumentFolderFilter();
    //Set to order by name
    DocumentFolderQueryOrder nameOrder = new DocumentFolderQueryOrder(DocumentFolderAttributes.Name, true);
    DocumentFolderQueryOrder[] orders = new DocumentFolderQueryOrder[]}nameOrder};
    filter.QueryOrders = orders;
    //To find folders in a project, we must look in the top level folder
    DocumentFolder topLevelFolder = documentManager.GetTopLevelFolder(project);
    DocumentFolder[] foundFolders = documentManager.QueryFolders(topLevelFolder, filter);

#### Exceptions

Exception Type | Condition
--- | ---
CollaborationException | The method call resulted in an error.
SoapException | There is a communication problem during the execution of the remote method call.
InvalidOperationException | The document folder has not yet been inserted or has already been removed.

#### See Also

IDocumentManager Interface | Plumtree.Remote.PRC.Collaboration.Document Namespace