IMAPIProp::GetProps

The IMAPIProp::GetProps method retrieves the property value of one or more properties of an object.

Quick Info

See IMAPIProp : IUnknown.

HRESULT GetProps(
  LPSPropTagArray lpPropTagArray,   
  ULONG ulFlags,                   
  ULONG FAR * lpcValues,           
  LPSPropValue FAR * lppPropArray  
);
 

Parameters

lpPropTagArray
[in] Pointer to an array of property tags identifying the properties whose values are to be retrieved. The lpPropTagArray parameter must either be NULL, indicating that values for all properties of the object should be returned, or point to an SPropTagArray structure containing one or more property tags.
ulFlags
[in] Bitmask of flags that indicates the format for properties that have the type PT_UNSPECIFIED. The following flag can be set:
MAPI_UNICODE
The string values for these properties should be returned in the Unicode format. If the MAPI_UNICODE flag is not set, the string values should be returned in the ANSI format.
lpcValues
[out] Pointer to a count of property values pointed to by the lppPropArray parameter. If lppPropArray is NULL, the contents of the lpcValues parameter is zero.
lppPropArray
[out] Pointer to a pointer to the retrieved property values.

Return Values

S_OK
The property values were successfully retrieved.
MAPI_W_ERRORS_RETURNED
The call succeeded overall, but one or more properties could not be accessed. The ulPropTag member of the property value for each unaccessible property has a property type of PT_ERROR and an identifier of zero. When this warning is returned, the call should be handled as successful. To test for this warning, use the HR_FAILED macro. See Using Macros for Error Handling.
MAPI_E_INVALID_PARAMETER
Zero was passed in the cValues member of the SPropTagArray structure pointed to by lpPropTagArray.

Remarks

The IMAPIProp::GetProps method gets the property values of one or more properties of an object.

The property values are returned in the same order as they were requested. That is, the order of properties in the property tag array pointed to by lpPropTagArray matches the order in the array of property value structures pointed to by lppPropArray.

The property types specified in the aulPropTag members of the property tag array indicate the type of value that should be returned in the Value member of each property value structure. However, if the caller does not know the type of a property, the type in the aulPropTag member can be set instead to PT_UNSPECIFIED. In retrieving the value, GetProps sets the correct type in the ulPropTag member of the property value structure for the property.

If property types are specified in the SPropTagArray in lpPropTagArray, then the property values in the SPropValue returned in lppPropArray have types that exactly match the requested types, unless an error value is returned instead.

String properties can have one of two property types: PT_UNICODE to represent the Unicode format and PT_STRING8 to represent the ANSI format. If the MAPI_UNICODE flag is set in the ulFlags parameter, whenever GetProps cannot determine the appropriate format for a string property, it returns its value in the Unicode format. GetProps cannot determine an exact string property type:

If the lpPropTagArray parameter is set to NULL to retrieve all of the properties of the object and no properties exist, GetProps:

Notes to Implementers

Call the MAPIAllocateBuffer function to allocate memory initially for the SPropValue structure pointed to by lpPropTagArray; call MAPIAllocateMore to allocate any additional memory needed for the structure's members.

Return MAPI_W_ERRORS_RETURNED if you cannot retrieve the value for one or more of the requested properties. In the property value structure, set the type in the ulPropTag member to PT_ERROR and the Value member to a status code describing the error. For example, if you need to convert a string to Unicode and do not support Unicode, set the Value member to MAPI_E_BAD_CHARWIDTH. If the property is too large, set it to MAPI_E_NOT_ENOUGH_MEMORY. If the object does not support the property, set it to MAPI_E_NOT_FOUND.

A remote transport provider's implementation of the GetProps method must return the folder's property values for properties requested by the caller. Your implementation needs to:

A remote transport provider's implementation of the GetProps method needs to support the following properties at a minimum:

PR_ACCESS PR_ACCESS_LEVEL
PR_CONTENT_COUNT PR_ASSOC_CONTENT_COUNT
PR_FOLDER_TYPE PR_OBJECT_TYPE
PR_SUBFOLDERS PR_CREATION_VERSION
PR_CREATION_TIME PR_DISPLAY_NAME
PR_DISPLAY_TYPE

Notes to Callers

For properties of type PT_OBJECT, call the IMAPIProp::OpenProperty method instead of GetProps.

For secure properties, do not expect to retrieve them by calling GetProps with the lppPropTagArray parameter set to NULL. You must explicitly set a secure property's identifier in the aulPropTag member of its property tag array when calling GetProps. When and how a secure property is available is up to the service provider.

Free the returned SPropValue structure by calling the MAPIFreeBuffer function only if GetProps returns S_OK or MAPI_W_ERRORS_RETURNED.

If GetProps returns MAPI_W_ERRORS_RETURNED because it could not access one or more properties, check the property tags of the returned properties. The failed properties will have the following values set in their property value structure:

Properties that fail because they are too large to conveniently be returned in the property value structure have their Value member set to MAPI_E_NOT_ENOUGH_MEMORY. Typically, this occurs with string or binary properties of type PT_STRING8, PT_UNICODE, or PT_BINARY when the value of the property is 4K or larger. Call IMAPIProp::OpenProperty to retrieve large properties.

Not all implementations of GetProps support both the Unicode and ANSI formats for character strings. When a particular property requires string format conversion and GetProps cannot support it, the Value member for the property is set to MAPI_E_BAD_CHARWIDTH.

For more information about using GetProps to access properties, see Retrieving Properties.

See Also

IMAPIProp::OpenProperty, MAPIAllocateBuffer, MAPIAllocateMore, MAPIFreeBuffer, SPropTagArray, SPropValue