PSGetNameFromPropertyKey function (propsys.h)

Retrieves the canonical name of the property, given its PROPERTYKEY.

Syntax

PSSTDAPI PSGetNameFromPropertyKey(
  [in]  REFPROPERTYKEY propkey,
  [out] PWSTR          *ppszCanonicalName
);

Parameters

[in] propkey

Type: REFPROPERTYKEY

Reference to a PROPERTYKEY structure that identifies the requested property.

[out] ppszCanonicalName

Type: PWSTR*

When this function returns, contains a pointer to the property name as a null-terminated Unicode string.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
The property's canonical name is obtained.
TYPE_E_ELEMENTNOTFOUND
Indicates that the PROPERTYKEY does not exist in the schema subsystem cache.

Remarks

Retrieves a canonical name for a specified property key. Like property keys, canonical names uniquely identify a property. For example, System.Keywords is the canonical name for PKEY_Keywords. This function succeeds only for properties registered as part of the property schema.

It is the responsibility of the calling application to use CoTaskMemFree to release the string referred to by ppszCanonicalName when it is no longer needed.

Examples

The following example, to be included as part of a larger program, demonstrates how to use PSGetNameFromPropertyKey to read a value from serialized property storage.

PWSTR pszName;

HRESULT hr = PSGetNameFromPropertyKey(PKEY_Keywords, &pszName);

if (SUCCEEDED(hr))
{
    // pszName now contains L"System.Keywords"
 
    CoTaskMemFree(pszName);
}

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header propsys.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0

See also

IPropertyDescription::GetCanonicalName

PSGetPropertyDescriptionByName

PSGetPropertyKeyFromName

PSStringFromPropertyKey