PSGetNameFromPropertyKey function

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

Syntax


HRESULT PSGetNameFromPropertyKey(
  _In_   REFPROPERTYKEY propkey,
  _Out_  PWSTR *ppszCanonicalName
);

Parameters

propkey [in]

Type: REFPROPERTYKEY

Reference to a PROPERTYKEY structure that identifies the requested property.

ppszCanonicalName [out]

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

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

IPropertyDescription::GetCanonicalName
PSGetPropertyKeyFromName
PSGetPropertyDescriptionByName
PSStringFromPropertyKey

 

 

Community Additions

ADD
Show:
© 2014 Microsoft