Reading a View's Restriction Property Values
When reading a restriction from the view description streams, there are cases where you must read the property values. For more information, see Reading a View's Row Restriction.
The procedure for reading the property values for a view restriction assumes that the following parameters were passed to this function:
-
Pstm
-
A stream on the PR_VD_BINARY property.
-
pstmSz
-
A stream on the PR_VD_STRINGS property.
-
pib
-
An input buffer.
-
presRoot
-
The root of the restriction being read.
-
pcval
-
Pointer to the number of property values to read.
-
ppval
-
Pointer to an array of pointers to property values to read.
To read the property values for a view restriction
-
Read a ULONG from the binary stream to get the count of the number of property values to read. If the count is zero, the view descriptor is invalid.
-
Use MAPIAllocateMore to enlarge the memory allocated to presRoot by the number of properties to be read times the size of SPropValue.
-
Declare a pointer to a property value (SPropValue * pval)
-
Read the properties into the end of the presRoot. This can be done all at once because they are packed in the binary stream and point pval to the first property read in.
-
For each property value read in:
If pval->ulPropTag == PT_BINARY, append the binary bytes onto the end of presRoot by using MAPIAllocateMore to allocate the number of bytes specified in pval->Value.bin.cb and then reading the bytes from the binary stream into the newly allocated space.
If pval->ulPropTag == PT_TSTRING, read the string from the string stream. Allocate sufficient memory to the end of presRoot by using MAPIAllocateMore, and then copy the string into the newly allocated space.
For all other properties, there is no additional information to read.