# IPropertyStorage::WritePropertyNames

Assigns string names to a specified array of property IDs in the current property set.

HRESULT WritePropertyNames(

ULONG cpropid, | //Size on input of the array rgpropid
PROPID const rgpropid[], | //Property identifiers for which names are to be set
LPWSTR const rglpwstrName[], | //New names of the corresponding property identifiers
); |

Parameters

cpropid
  [in] Size on input of the array rgpropid. May legally be zero, though this is a no-op, writing no property names.
rgpropid[]
  [in] Array of the property identifiers for which names are to be set.
rglpwstrName[]
  [in] Array of new names to be assigned to the corresponding property identifiers in the rgpropid array. These names may not exceed 255 characters (not including the NULL terminator).

Return Values

This method supports the standard return value E_UNEXPECTED, as well as the following:

S_OK
  Success. All of the indicated string names were successfully set.
STG_E_INVALIDNAME
  At least one of the indicated property identifier values does not exist in this property set. No names were set.
STG_E_ACCESSDENIED
  The requested access to the property storage object has been denied. No property names have been changed in the storage.
STG_E_INSUFFICIENTMEMORY
  There is not sufficient memory to perform this operation. Some names may not have been set.
STG_E_INVALIDPARAMETER
  A parameter is invalid. Some names may not have been set.
HRESULT_FROM_WIN32(ERROR_NO_UNICODE_TRANSLATION)
  There was a failed attempt to translate a Unicode string to or from Ansi.

Remarks

IPropertyStorage::WritePropertyNames assigns string names to property identifiers passed to the method in the rgpropid array. It associates each string name in the rglpwstrName array with the respective property identifier in rgpropid. It is explicitly valid to define a name for a property identifier that is not currently present in the property storage object.

It is also valid to change the mapping for an existing string name (determined by a case-insensitive match). That is, you can use the WritePropertyNames method to map an existing name to a new property identifier, or to map a new name to a property identifier that already has a name in the dictionary. In either case, the original mapping is deleted. Property names must be unique (as are property identifiers) within the property set.

The storage of string property names preserves the case. String property names are limited in length to 128 characters. Property names that begin with the binary Unicode characters 0x0001 through 0x001F are reserved for future use.

See Also

IPropertyStorage::ReadPropertyNames, IPropertyStorage::ReadMultiple, IPropertyStorage::WriteMultiple