Send Feedback

The GetIDsFromNames method retrieves the property identifiers that correspond to one or more property names.

Note   Windows Mobile-based Messaging implements this method only for IMessage and IMsgStore interface objects.


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


  • cPropNames
    [in] Count of property names pointed to by lppPropNames; cannot be zero.

  • lppPropNames
    [in] Reference to an array of property names, with each property name specified by a MAPINAMEID structure; cannot be NULL.

  • ulFlags
    [in] Bitmask of flags that indicates how the property identifiers should be returned. The following flag can be set:


    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] Reference to an SPropTagArray structure that is an array of property tags containing existing or newly assigned property identifiers.

Note   The returned property tags do not contain the associated type information. To retrieve the complete property tags, you must run the macro CHANGE_PROP_TYPE and apply a property type to each property tag.

Return Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    Indicates success.
    The object does not support named properties.
    Insufficient memory available to retrieve the identifiers.
    The operation cannot be performed because it requires the return of too many property tags.
    A flag other than MAPI_CREATE was set in the ulFlags parameter.
    The call succeeded, 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.


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

  • Create identifiers for new names.
  • Retrieve identifiers for specific names.
  • Retrieve identifiers for all named properties that are included in the object's mapping.

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.

Only MAPINAMEID::lpguid == PS_MAPI properties are supported.

If there are no errors returning an identifier, the property types for the returned identifiers in the property tag array pointed to by lppPropTags are set to PT_UNSPECIFIED. You need to call the GetProps method to retrieve the accurate property types.

Some objects have a limit for 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.

To clean up after a successful call, you must call the MAPIFreeBuffer function on lppPropTags.


Pocket PC: Pocket PC 2002 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: mapidefs.h
Library: cemapi.lib

See Also


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.