Function

LSCopyItemAttribute

Obtains the value of an item’s attribute.

Declaration

OSStatus LSCopyItemAttribute(const FSRef *inItem, LSRolesMask inRoles, CFStringRef inAttributeName, CFTypeRef *outValue);

Parameters

inItem

The FSRef of the item to query.

inRoles

The roles. When obtaining attributes related to document binding (such as kLSItemRoleHandlerDisplayName), at least one of the roles must be provided by the application selected. Pass kLSRolesAll if any role is acceptable.

inAttributeName

The name of the attribute to copy. For possible values, see Item Attribute Constants.

outValue

A pointer to a CFTypeRef. On return, the CFTypeRef is set to the copied attribute value (a CF object), or is NULL if an error occurs. The type of the returned object varies depending on the attribute that is requested.

Return Value

A result code; see Result Codes.

Discussion

Thread-safe since OS X v10.4.

See Also

Obtaining Information About an Item

LSCopyItemInfoForRef

Obtains requested information about an item designated by file-system reference.

Deprecated
LSCopyItemInfoForURL

Obtains requested information about an item designated by URL.

Deprecated
LSCopyDisplayNameForRef

Obtains the display name for an item designated by file-system reference.

Deprecated
LSCopyDisplayNameForURL

Obtains the display name for an item designated by URL.

Deprecated
LSCopyKindStringForRef

Obtains the kind string for an item designated by file-system reference.

Deprecated
LSCopyKindStringForURL

Obtains the kind string for an item designated by URL.

Deprecated
LSCopyKindStringForTypeInfo

Obtains a kind string for items with a specified file type, creator signature, filename extension, or any combination of these characteristics.

Deprecated
LSCopyKindStringForMIMEType

Obtains the kind string for a specified MIME type.

Deprecated
LSCopyItemAttributes

Obtains multiple item attribute values as a dictionary.

Deprecated