<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "OpenDirectory",
  "identifier" : "/documentation/OpenDirectory/ODQuery",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Open Directory"
    ],
    "preciseIdentifier" : "c:objc(cs)ODQuery"
  },
  "title" : "ODQuery"
}
-->

# ODQuery

An `ODQuery` object serves as a Cocoa wrapper for an Open Directory query.

```
class ODQuery
```

## Topics

### Creating and Initializing a Query

[`init(node:forRecordTypes:attribute:matchType:queryValues:returnAttributes:maximumResults:)`](/documentation/OpenDirectory/ODQuery/init(node:forRecordTypes:attribute:matchType:queryValues:returnAttributes:maximumResults:))

Creates a query object with provided parameters.

[`queryWithNode:forRecordTypes:attribute:matchType:queryValues:returnAttributes:maximumResults:error:`](/documentation/OpenDirectory/ODQuery/queryWithNode:forRecordTypes:attribute:matchType:queryValues:returnAttributes:maximumResults:error:)

Returns an autoreleased query object created with provided parameters.

### Managing Asynchronous Queries

[`delegate`](/documentation/OpenDirectory/ODQuery/delegate)

The query’s delegate.

[`operationQueue`](/documentation/OpenDirectory/ODQuery/operationQueue)

The queue on which asynchronous results are delivered to the delegate.

[`schedule(in:forMode:)`](/documentation/OpenDirectory/ODQuery/schedule(in:forMode:))

Retrieves results from a query asynchronously by scheduling the query in a run loop.

[`remove(from:forMode:)`](/documentation/OpenDirectory/ODQuery/remove(from:forMode:))

Removes the query from a specified run loop.

[`synchronize()`](/documentation/OpenDirectory/ODQuery/synchronize())

Restarts a query, disposing of any results it has obtained.

### Managing Synchronous Queries

[`resultsAllowingPartial(_:)`](/documentation/OpenDirectory/ODQuery/resultsAllowingPartial(_:))

Returns results from a query synchronously.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)