IMAPIProp::GetIDsFromNames

The IMAPIProp::GetIDsFromNames method provides the property identifiers that correspond to one or more property names.

Quick Info

See IMAPIProp : IUnknown.

HRESULT GetIDsFromNames(
  ULONG cPropNames,                  
  LPMAPINAMEID FAR * lppPropNames,   
  ULONG ulFlags,                     
  LPSPropTagArray FAR * lppPropTags  
);
 

Parameters

cPropNames
[in] Count of property names pointed to by the lppPropNames parameter. If lppPropNames is NULL, the cPropNames parameter must be zero.
lppPropNames
[in] Pointer to an array of property names or NULL. Passing NULL requests property identifiers for all property names in all property sets about which the object has information. The lppPropNames parameter must not be NULL if the MAPI_CREATE flag is set in the ulFlags parameter.
ulFlags
[in] Bitmask of flags that indicates how the property identifiers should be returned. The following flag can be set:
MAPI_CREATE
Assigns a property identifier to one or more of the names included in the property name array pointed to by lppPropNames if one has not yet been assigned. Internally registers the identifier in the name-to-identifier mapping table.
lppPropTags
[out] Pointer to a pointer to an array of property tags containing existing or newly assigned property identifiers. The property types for the property tags in this array are set to PT_UNSPECIFIED.

Return Values

S_OK
The identifiers for the specified property names were successfully returned.
MAPI_E_NO_SUPPORT
The object does not support named properties.
MAPI_E_NOT_ENOUGH_MEMORY
Insufficient memory was available to retrieve the identifiers.
MAPI_E_TOO_BIG
The operation cannot be performed because it requires too many property tags be returned.
MAPI_W_ERRORS_RETURNED
The call succeeded overall, but one or more property identifiers could not be returned. The corresponding property type for each inaccessible property is set to PT_ERROR and its identifier to zero. When this warning is returned, handle the call as successful. To test for this warning, use the HR_FAILED macro. See Using Macros for Error Handling.

Remarks

The IMAPIProp::GetIDsFromNames method retrieves an array of property tags that hold the property identifiers for one or more named properties. IMAPIProp::GetIDsFromNames can be called to:

Named properties are commonly used by message store providers for folders and messages. Other objects, such as messaging users and profile sections, might not support the association of names to property identifiers and return MAPI_E_NO_SUPPORT from GetIDsFromNames.

If there is an error returning an identifier for a particular name, GetIDsFromNames returns MAPI_W_ERRORS_RETURNED and sets the property type in the property tag array entry that corresponds to the name to PT_ERROR and the identifier to zero.

Name-to-identifier mapping is represented by an object's PR_MAPPING_SIGNATURE property. PR_MAPPING_SIGNATURE contains a MAPIUID structure that indicates the service provider responsible for the object. If the PR_MAPPING_SIGNATURE property is the same for two objects, assume that these objects use the same name-to-identifier mapping.

Notes to Implementers

The identifiers that you pass back in the property tag array pointed to by lppPropNames must be in the 0x8000 to 0xFFFE range. The entries in this array must be in the same order as the names passed in the property name array pointed to by lppPropNames.

If you support named properties on a container, use the same name-to-identifier mapping for all objects in your container. That is, do not use a different mapping for each folder in your message store or each message in your folder.

Notes to Callers

Because the property types for the returned identifiers in the property tag array pointed to by lppPropTags are set to PT_UNSPECIFIED, you will need to call IMAPIProp::SetProps to retrieve the accurate types.

If you move or copy objects with named properties, and the source and destination objects have different mapping signatures as indicated by the values of their PR_MAPPING_SIGNATURE properties, you must preserve the names during these operations. To preserve property names, adjust the corresponding property identifiers to match the name-to-identifier mapping of the destination object.

Some objects have a limit as to the number of property identifiers they can name. If a call to GetIDsFromNames causes this limit to be exceeded, the method returns MAPI_E_TOO_BIG. In this case, query by identifier.

For more information, see Named Properties.

See Also

IMAPIProp::GetNamesFromIDs, MAPINAMEID, MAPIUID