PSGetPropertyKeyFromName

PSGetPropertyKeyFromName function

Gets the property key for a canonical property name.

Syntax


HRESULT PSGetPropertyKeyFromName(
  _In_  PCWSTR      pszName,
  _Out_ PROPERTYKEY *ppropkey
);

Parameters

pszName [in]

Type: PCWSTR

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

ppropkey [out]

Type: PROPERTYKEY*

When this function returns, contains the requested property key.

Return value

Type: HRESULT

Returns one of the following values.

Return codeDescription
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

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propsys.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

PSGetNameFromPropertyKey
PSGetPropertyDescription
PSPropertyKeyFromString
IPropertyDescription::GetPropertyKey

 

 

Show:
© 2016 Microsoft