The IMAPIProp::GetNamesFromIDs method provides the property names that correspond to one or more property identifiers.
See IMAPIProp : IUnknown.
HRESULT GetNamesFromIDs(
LPSPropTagArray FAR * lppPropTags,
LPGUID lpPropSetGuid,
ULONG ulFlags,
ULONG FAR * lpcPropNames,
LPMAPINAMEID FAR * FAR * lpppPropNames
);
If both flags are set, no names will be returned.
While access to most properties is by property identifier, some properties can be accessed by name. The IMAPIProp::GetNamesFromIDs method can be called to:
If lppPropTags points to a valid property tag array with one or more property identifiers and lpPropSetGuid points to a valid property set, GetNamesFromIDs ignores the property set and the property types and returns all of the names that map to the specified identifiers.
If lppPropTags points to a valid property tag array with one or more property identifiers and lpPropSetGuid is NULL, GetNamesFromIDs returns all of the names that map to the specified identifiers.
If a specified identifier does not have a name, GetNamesFromIDs returns NULL in that identifier's place in the structure returned in lpppPropNames and also returns MAPI_W_ERRORS_RETURNED.
If both lpPropSetGuid and lppPropTags are NULL, GetNamesFromIDs allocates a new property tag array and returns all of the names for all of the named properties for the object.
When there are no names to be returned, perhaps because there are no properties in the requested property set or all of the properties are of a type excluded by the flags, GetNamesFromIDs:
If lpPropSetGuid points to a valid property set and lppPropsTags is NULL, the result is undefined. You can implement one of the following strategies:
To retrieve all of the named properties for an object, you must first call the object's IMAPIProp::GetPropList method and then pass the returned identifiers that are above the 0x8000 range to GetNamesFromIDs.
If you pass a valid property set but not a valid property tag array, be prepared for unpredictable results. Some implementations of GetNamesFromIDs ignore the property set and return the names for the identifiers in the property tag array. Some implementations return MAPI_E_INVALID_PARAMETER. Still other implementations return names for identifiers of all properties in the property set. If the property set is PS_PUBLIC_STRINGS, GetNamesFromIDs can return all names that were ever created. Whether or not the service provider stores a property under the identifiers associated with the public strings is immaterial.
When you are finished with the property names, check the contents of the lpcPropNames parameter to determine if any names were returned. If so, call MAPIFreeBuffer to free the memory pointed to by lppPropTags and lpppPropNames when success is returned. One call to MAPIFreeBuffer is sufficient for each parameter; you do not need to traverse the array of pointers and free each MAPINAMEID structure individually.
For more information about named properties, see Named Properties.