3.1.4.5.2 Fractional Positioning
The second form of specifying position in a STAT structure–based table is called Fractional Positioning. The client specifies this type of positioning by setting the field CurrentRec to the value MID_CURRENT. Fractional positioning is defined as only an approximation in the Exchange Server NSPI Protocol. The server MAY be inaccurate both in locating a row based on fractional positioning and in reporting the resultant actual fractional position. The server uses the following steps to identify the Current Position specified by the client:
First, the server identifies the LCID it supports that is closest to the LCID specified by the SortLocale field. The server MAY choose this closest LCID in any way.
The server sorts the objects in the address book container specified by the ContainerID field by the sort type specified in the SortType field and the LCID specified in step 1 of section 3.1.4.3.
The server identifies the number of objects in the sorted table. The server reports this in the TotalRecs field of the STAT structure.
The server calculates the Intended Numeric Position in the table as the TotalRecs reported by the server multiplied by the NumPos field of the STAT structure divided by the value of TotalRecs as specified by the client. The value is truncated to its integral part.
If the Intended Numeric Position thus calculated is greater than TotalRecs, the intended Intended Numeric Position is TotalRecs (that is, the last row in the table).
After the server has identified the Intended Numeric Position, the server sets Numeric Position to an approximation of that value. Although the protocol places no boundary or requirements on the accuracy of the approximation the server uses to set the Numeric Position, it is recommended that implementations maximize accuracy of the approximation to improve usability of the server for clients.
The server moves the Current Position to the row chosen in step 6.
The server moves the Current Position by the number of rows specified by the absolute value of the Delta field of the STAT structure. If the value of Delta is negative, the Current Position is moved toward the beginning of the table. If the value of Delta is positive, the Current Position is moved toward the end of the table. A Delta field with the value 0 results in no change to the Current Position.
If applying the Delta as described in step 8 would move the Current Position to be before the beginning of the table, the server sets the Current Position to the beginning of the table and sets the CurrentRec field to the Minimal Entry ID of the object occupying the first row of the table.
If applying Delta as described in step 8 would move the Current Position to be after the end of the table, the server sets the Current Position to a location one row past the last valid row of the table and sets the CurrentRec to the value MID_END_OF_TABLE.
The server sets the field CurrentRec to the Minimal Entry ID of the object occupying the row specified by the Current Position.
The server identifies the numeric row of the Current Position in the sorted table. This numeric row is 0-based. That is, the first valid row in the table has the numeric position 0. This is the Numeric Position of the Current Position of the table. The server reports this in the NumPos field of the STAT structure.