<div class="content" name="FAX_AddOutboundRule" uuid="3d7159bc-9650-4cb8-9aab-c5e7baf8534d"><p>The <b>FAX_AddOutboundRule (Opnum 56)</b> method is called
by the client to add a new outbound rule for the specified outbound group to
the fax server’s rules map. The value for the <i>dwDeviceId</i> parameter can
be obtained using the <b>FAX_EnumPorts</b> (section <a href="7143a58b-d7c5-4353-8857-39c7f708e778" data-linktype="relative-path">3.1.4.1.28</a>) method or the <b>FAX_EnumPortsEx</b>
(section <a href="f26e50ab-ed8e-448d-928c-1820f4a42918" data-linktype="relative-path">3.1.4.1.29</a>)
method.</p><p>In response, if bUseGroup is <b>TRUE</b>, the server MUST
validate that the group name is valid; if bUseGroup is <b>FALSE</b>, the server
MUST validate that the device ID is for a valid device. The server MUST
validate that the client&#39;s fax user account has access to add an outbound <a href="46aba9c4-ebb1-4b10-86ac-4bb3025657b9#gt_e3969a6a-4722-476e-9a36-bb63311ae950" data-linktype="relative-path">routing rule</a>.</p><p>On success, the server MUST add an outbound rule to the fax
server.</p><dl>
<dd>
<div><pre> error_status_t FAX_AddOutboundRule(
   [in] handle_t hFaxHandle,
   [in] DWORD dwAreaCode,
   [in] DWORD dwCountryCode,
   [in] DWORD dwDeviceId,
   [in, string, unique] LPCWSTR lpwstrGroupName,
   [in] BOOL bUseGroup
 );
</pre></div>
</dd></dl><p><b>hFaxHandle: </b>The RPC binding handle for this
call. The client SHOULD reuse the RPC binding handle used as an input <i>hBinding</i>
argument for the <b>FAX_ConnectFaxServer</b> (section <a href="5cbfd38d-7a14-4560-ad24-9ed78f19a3bb" data-linktype="relative-path">3.1.4.1.10</a>) or <b>FAX_ConnectionRefCount</b>
(section <a href="a92941ac-bd07-4a71-af85-c2c157c97cf9" data-linktype="relative-path">3.1.4.1.11</a>)
method call used to connect to the fax server.</p><p><b>dwAreaCode: </b>The area code of the rule. A value
of zero indicates the special any-area value ROUTING_RULE_AREA_CODE_ANY. The
combination of the <i>dwAreaCode</i> and <i>dwCountryCode</i> parameters is a
unique key.</p><p><b>dwCountryCode: </b>The country/region code of the
rule. The value of this argument MUST NOT be zero. A value of zero indicates
the special any-country, any-region value ROUTING_RULE_COUNTRY_CODE_ANY, which
is not valid for this argument. The combination of <i>dwAreaCode</i> and <i>dwCountryCode</i>
is a unique key.</p><p><b>dwDeviceId: </b>The destination device of the
rule. This value is valid only if the <i>bUseGroup</i> parameter is <b>FALSE</b>.
The value of <i>dwDeviceId</i> MUST be greater than zero.</p><p><b>lpwstrGroupName: </b>The destination group of the
rule. This value is valid only if <i>bUseGroup</i> is <b>TRUE</b>.</p><p><b>bUseGroup: </b>A Boolean value that specifies
whether the group SHOULD be used as the destination.</p><p><b>Return Values: </b>This method MUST return
0x00000000 (ERROR_SUCCESS) for success; otherwise, it MUST return one of the
following error codes, one of the fax-specific errors that are defined in
section <a href="cbe6c4fb-4dda-4f6c-9701-0d490ba0d105" data-linktype="relative-path">2.2.52</a>, or one
of the other standard errors defined in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>
section <a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>ERROR_ACCESS_DENIED 0x00000005</td>
  <td>Access is denied. The client&#39;s fax user account does not have authorization required for this call (FAX_ACCESS_MANAGE_CONFIG).</td>
 </tr><tr>
  <td>ERROR_BAD_UNIT 0x00000014</td>
  <td>The system cannot find the device specified by the dwDeviceId argument.</td>
 </tr><tr>
  <td>ERROR_GEN_FAILURE 0x0000001F</td>
  <td>The fax server encountered an exception while processing the character string specified by the lpwstrGroupName argument.</td>
 </tr><tr>
  <td>ERROR_INVALID_PARAMETER 0x00000057</td>
  <td>The parameter is incorrect. This error code is returned when any of the following conditions are met: § The country code specified with the dwCountryCode argument is ROUTING_RULE_COUNTRY_CODE_ANY (not a valid rule dialing location). § The lpwstrGroupName argument value is NULL. § The value of the dwDeviceId argument is 0. § The fax server needs to return FAX_ERR_NOT_SUPPORTED_ON_THIS_SKU, but the client fax API version (FAX_API_VERSION_0, described in section 3.1.4.1.10) does not support this error code.</td>
 </tr><tr>
  <td>ERROR_BUFFER_OVERFLOW 0x0000006F</td>
  <td>The destination group of the rule specified by the lpwstrGroupName argument is longer than the maximum supported value of 128 characters (excluding the terminating null character).</td>
 </tr><tr>
  <td>ERROR_REGISTRY_CORRUPT 0x000003F7</td>
  <td>The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system&#39;s memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted.</td>
 </tr><tr>
  <td>FAX_ERR_BAD_GROUP_CONFIGURATION 0x00001B5B</td>
  <td>The fax server encountered an outbound routing group with a bad configuration, or the group device list is empty; the status for the new rule object created by the server based on the specified dialing location and device ID is FAX_RULE_STATUS_ALL_GROUP_DEV_NOT_VALID or FAX_RULE_STATUS_EMPTY_GROUP.</td>
 </tr><tr>
  <td>FAX_ERR_NOT_SUPPORTED_ON_THIS_SKU 0x00001B63</td>
  <td>The fax client module API version (described in section 3.1.4.1.10) is FAX_API_VERSION_1 or above, and the fax server is running on a version of the operating system that does not support the requested operation.&lt;69&gt;</td>
 </tr></tbody></table>
</dd></dl><p><b>Exceptions Thrown: </b>No exceptions are thrown
except those that are thrown by the underlying <a href="46aba9c4-ebb1-4b10-86ac-4bb3025657b9#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>