---
title: "MDQueryCopyValuesOfAttribute(_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1413105-mdquerycopyvaluesofattribute
---

# MDQueryCopyValuesOfAttribute(_:_:)

Returns the list of values from the results of the query for the specified attribute.

## Declaration

```swift
func MDQueryCopyValuesOfAttribute(_ query: MDQuery!, _ name: CFString!) -> CFArray!
```

## Parameters

- `query`: The query.
- `name`: The attribute name to return the value of. If the attribute is not one of those requested when the query was created the behavior is undefined

## Return Value

Return Value A CFArrayRef containing the value objects for the specified attribute. The array contents are not ordered and contain only one occurrence of each value. The array contents may change over time if the query is configured for live-updates.

## See Also

### Getting Query Result Values

- [MDQueryGetAttributeValueOfResultAtIndex(_:_:_:)](coreservices/1413046-mdquerygetattributevalueofresult.md)
- [MDQueryGetCountOfResultsWithAttributeValue(_:_:_:)](coreservices/1413009-mdquerygetcountofresultswithattr.md)
- [MDQueryGetIndexOfResult(_:_:)](coreservices/1413093-mdquerygetindexofresult.md)
- [MDQueryGetResultAtIndex(_:_:)](coreservices/1413055-mdquerygetresultatindex.md)
- [MDQueryGetResultCount(_:)](coreservices/1413008-mdquerygetresultcount.md)
- [MDQuerySetSortComparatorBlock(_:_:)](coreservices/1413021-mdquerysetsortcomparatorblock.md)
