<div class="content"><p> </p><p>The NspiQueryRows method returns to the client a number of
rows from a specified table. The server MUST return no more rows than the
number specified in the input parameter <i>Count</i>. Although the protocol
places no further boundary or requirements on the minimum number of rows the
server returns, implementations SHOULD return as many rows as possible subject
to this maximum limit to improve usability of the <span><a href="1b8009c5-72bc-41da-bbab-612b31da4410#gt_e63aea5b-046b-4176-9359-fde82613a406" data-linktype="relative-path">NSPI</a></span> server for
clients.</p><dl>
<dd>
<div><pre> long NspiQueryRows(
   [in] NSPI_HANDLE hRpc,
   [in] DWORD dwFlags,
   [in, out] STAT* pStat,
   [in, range(0,100000)] DWORD dwETableCount,
   [in, unique, size_is(dwETableCount)] 
     DWORD* lpETable,
   [in] DWORD Count,
   [in, unique] PropertyTagArray_r* pPropTags,
   [out] PropertyRowSet_r** ppRows
 );
</pre></div>
</dd></dl><p><b>hRpc: </b>An <span><a href="1b8009c5-72bc-41da-bbab-612b31da4410#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> context handle
as specified in section <span><a href="67195f6a-2002-4d81-b279-ba8b0aefb4af" data-linktype="relative-path">2.3.9</a></span>.</p><p><b>dwFlags: </b> A <span><a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a></span>
value, containing a set of bit flags. The server MUST ignore values other than
the bit flags <b>fEphID</b> and <b>fSkipObjects</b>.</p><p><b>pStat: </b>A pointer to a <span><a href="5902bec9-3124-4725-8a8f-1a50282ed023" data-linktype="relative-path">STAT</a></span>
block describing a logical position in a specific <span><a href="1b8009c5-72bc-41da-bbab-612b31da4410#gt_a34b031c-18b2-40e1-acfa-3b73cc71e80b" data-linktype="relative-path">address book container</a></span>.
This parameter is used to specify both input parameters from the client and
return values from the NSPI server.</p><p><b>dwETableCount: </b>A DWORD value containing the
number values in the input parameter <i>lpETable</i>. This value is limited to
100,000.</p><p><b>lpETable: </b> An array of DWORD values,
representing an Explicit Table (see <span><a href="6520bf55-9a29-426a-b7eb-88dcfc9877ad" data-linktype="relative-path">Explicit
Tables (section 3.1.1.3.2)</a></span>).</p><p><b>Count: </b>A DWORD value containing the number of
rows the client is requesting.</p><p><b>pPropTags: </b>The value NULL or a reference to a <span><a href="9dc42856-90da-4df9-85ca-f8307db84659" data-linktype="relative-path">PropertyTagArray_r</a></span>
value, containing a list of the <span><a href="1b8009c5-72bc-41da-bbab-612b31da4410#gt_7eb84614-827d-4b68-a71c-dd94eb0ad27f" data-linktype="relative-path">proptags</a></span> of the
properties that client requires to be returned for each row returned.</p><p><b>ppRows: </b>A reference to a <span><a href="0c81c77a-009c-4077-991e-a2ce23584adf" data-linktype="relative-path">PropertyRowSet_r</a></span>
value. Contains the address book container rows the server returns in response
to the request.</p><p><b>Return Values: </b> The server returns a long
value specifying the return status of the method.</p><p>Exceptions Thrown</p><p>No exceptions are thrown beyond those thrown by the
underlying RPC protocol, as specified in <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>.</p><p>Server Processing Rules</p><p>Upon receiving this message, the server MUST process the
data from the message subject to the following constraints: </p><ol><li><p><span>    </span>If the <b>CodePage</b>
field of the input parameter pStat contains the value CP_WINUNICODE, the server
MUST return one of the return values documented in section <span><a href="03bb2ea3-f2e9-4adb-ab46-751aca824b72" data-linktype="relative-path">2.2.2</a></span>. 
No further constraints are applied to server processing of this method; in this
case server behavior is undefined.  Note especially that there is no constraint
on the data the server returns in any output parameter other than the return
value, nor is there any constraint on how or if the server changes its state.</p>
</li><li><p><span>    </span>If the input
parameter lpETable is NULL and the input parameter Count is 0, the server MUST
return one of the return values documented in section 2.2.2.  No further
constraints are applied to server processing of this method; in this case
server behavior is undefined.  Note especially that there is no constraint on
the data the server returns in any output parameter other than the return
value, nor is there any constraint on how or if the server changes its state.</p>
</li><li><p><span>    </span>If the server
returns any return values other than Success, the server MUST return a NULL for
the output parameter <i>ppRows</i> and MUST NOT modify the output parameter <i>pStat</i>.</p>
</li><li><p><span>    </span>The server MAY
make additional validations as described in section <span><a href="39bcbcd7-fa18-4eb2-a2ae-c598b6683185" data-linktype="relative-path">5</a></span>. If the server
chooses to limit the visibility of data based on these validations, the server
MUST proceed as if that data did not exist in the address book. See the product
behavior note cited in section <span><a href="36c0f768-1fdd-4709-9875-6c387b107560" data-linktype="relative-path">5.1</a></span> for more
information.</p>
</li><li><p><span>    </span>If the input
parameter <i>lpETable</i> is NULL and the server is unable to locate the
address book container specified by the <b>ContainerID</b> field in the input
parameter <i>pStat</i>, the server MUST return the return value
InvalidBookmark.</p>
</li><li><p><span>    </span>The server
constructs a list of proptags for which it will return property values as
follows:</p>
<ol><li><p><span>   
</span>If the input parameter <i>pPropTags</i> is not NULL, the client is
requesting the server return only those properties and their values in the
output parameter <i>ppRows</i>. The server MUST use this list.</p>
</li><li><p><span>   
</span>If the input parameter <i>pPropTags</i> is NULL, the client is
requesting that the server construct a list of proptags on its behalf. This
server MUST use the following proptag list (using proptags defined in <span><a href="/en-us/openspecs/exchange_server_protocols/MS-OXPROPS/f6ab1613-aefe-447d-a49c-18217230b148" data-linktype="absolute-path">[MS-OXPROPS]</a></span>),
in this order:</p>
<div><pre> {PidTagAddressBookContainerId,
 PidTagObjectType,
 PidTagDisplayType,
 PidTagDisplayName with the Property Type PtypString8,
 PidTagPrimaryTelephoneNumber with the Property Type PtypString8,
 PidTagDepartmentName with the Property Type PtypString8,
 PidTagOfficeLocation with the Property Type PtypString8}
</pre></div>
</li></ol></li><li><p><span>    </span>If the input
parameter <i>lpETable</i> is NULL, the server MUST use the table specified by
the input parameter <i>pStat</i> when constructing the return parameter <i>ppRows</i>.</p>
</li><li><p><span>    </span>If the input
parameter <i>lpETable</i> is not NULL, it contains an Explicit Table. The
server MUST use that table when constructing the return parameter <i>ppRows</i>.</p>
</li><li><p><span>    </span>If there are any
rows that satisfy the client&#39;s query, the server MUST return at least one row.</p>
</li><li><p><span>  </span>The server MUST return as
many rows as possible, up to the number value specified in the input parameter <i>Count</i>.
The server MAY return fewer for any reason.</p>
</li><li><p><span>  </span>The server MUST return rows
in the order they exist in the table being used.</p>
</li><li><p><span>  </span>If the server is using the
table specified by the input parameter <i>pStat</i>, the server MUST process
rows starting from the current position in the table specified in that
parameter (including any values of the field <b>Delta</b>).</p>
</li><li><p><span>  </span>If the server is using the
table specified by the input parameter <i>lpETable</i>, the server MUST process
rows starting from the beginning of the table.</p>
</li><li><p><span>  </span>The server constructs a
RowSet. Each row in the RowSet corresponds to a row in the table specified by
input parameters. The rows in the RowSet are in a one-to-one order preserving
correspondence with the rows in the table specified by input parameters. The
Rows placed into the RowSet are exactly those Rows that would be returned to
the client in the <i>ppRows</i> output parameter of the method <span><a href="3f482f70-c4a8-4697-8efd-8fbb9cf28614" data-linktype="relative-path">NspiGetProps</a></span>
(see section 3.1.4.7) using the following parameters:</p>
<ol><li><p><span>   
</span>The NspiQueryRows parameter <i>hRpc</i> is used as the NspiGetProps
parameter <i>hRpc</i>. </p>
</li><li><p><span>   
</span>The NspiQueryRows parameter <i>dwFlags</i> is used as the NspiGetProps
parameter <i>dwFlags</i>. </p>
</li><li><p><span>   
</span>The NspiQueryRows parameter <i>pStat</i> is used as the NspiGetProps
parameter <i>pStat</i>. The <b>CurrentRec</b> field is set to the <span><a href="1b8009c5-72bc-41da-bbab-612b31da4410#gt_42ecf4ed-a7e5-4044-a1f0-f67ca58fb4b6" data-linktype="relative-path">Minimal
Entry ID (MId)</a></span> of the row being returned.</p>
</li><li><p><span>   
</span>The list of proptags the server constructs as specified by constraint 5
is used as the NspiGetProps parameter <i>pPropTags</i>.</p>
<p>If a call to the
NspiGetProps method with these parameters would return any value other than
Success or ErrorsReturned, the server MUST return that error code as the return
value for the NspiQueryRows method. Otherwise, the server MUST return the
RowSet constructed in the output parameter <i>ppRows</i>.</p>
</li></ol></li><li><p><span>  </span>If the server has no rows
that satisfy this query, the server MUST place an PropertyRpw_r Set with 0 rows
in the output parameter <i>ppRows</i>. The server MUST return the return value
Success. </p>
</li><li><p><span>  </span>If the server is using the
table specified by the input parameter <i>pStat</i>, the server MUST update the
status of the table. This update MUST be exactly the same update that would
occur via the method <span><a href="bc5dcc9b-3629-4c21-9304-4e4cc79dc999" data-linktype="relative-path">NspiUpdateStat</a></span> with
the following parameters:</p>
<ol><li><p><span>   
</span>The NspiQueryRows parameter <i>hRpc</i> is used as the NspiUpdateStat
parameter <i>hRpc</i>.</p>
</li><li><p><span>   
</span>The value 0 is used as NspiUpdateStat parameter <i>Reserved</i>.</p>
</li><li><p><span>   
</span>The NspiQueryRows parameter <i>pStat</i> is used as the NspiGetProps
parameter <i>pStat</i>. The number of rows returned in the NspiQueryRows output
parameter <i>ppRows</i> is added to the <b>Delta</b> field.</p>
</li><li><p><span>   
</span>The value NULL is used as the NspiUpdateStat parameter <i>lpDelta</i>.
The list of proptags the server constructs as specified by constraint 5 is used
as the NspiGetProps parameter <i>pPropTags</i>. </p>
</li></ol></li><li><p><span>  </span>If no other return values
have been specified by these constraints, the server MUST return the return
value Success.</p>
</li></ol></div>