PSGetPropertyKeyFromName function (propsys.h)

Gets the property key for a canonical property name.

Syntax

PSSTDAPI PSGetPropertyKeyFromName(
  [in]  PCWSTR      pszName,
  [out] PROPERTYKEY *ppropkey
);

Parameters

[in] pszName

Type: PCWSTR

Pointer to a property name as a null-terminated, Unicode string.

[out] ppropkey

Type: PROPERTYKEY*

When this function returns, contains the requested property key.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Property key structure was obtained.
E_INVALIDARG
The pszName parameter is NULL.
TYPE_E_ELEMENTNOTFOUND
The canonical property name does not exist in the schema subsystem cache.

Remarks

Property keys uniquely identify a property. For example, PKEY_Keywords corresponds to System.Keywords. This function succeeds only for properties registered as part of the property schema.

See PSGetPropertyDescriptionByName for a list of legacy property names that are also supported by the function.

Examples

The following example, to be included as part of a larger program, demonstrates how to use PSGetPropertyKeyFromName to obtain the property key for System.Keywords.

PROPERTYKEY key;

HRESULT hr = PSGetPropertyKeyFromName(L"System.Keywords", &key);

if (SUCCEEDED(hr))
{
    // The property key is now valid.
}

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::GetPropertyKey

PSGetNameFromPropertyKey

PSGetPropertyDescription

PSPropertyKeyFromString