This documentation is archived and is not being maintained.

RcGenerateProxy Function

Exchange Server 2003

RcGenerateProxy Function

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The RcGenerateProxy function generates the proxy address for a recipient and returns it in a Unicode string.

Applies To


        [C++]RC RcGenerateProxy
    HANDLE hProxySession,
    PRECIPIENTINFO pRecipientInfo,
    INT nRetries,


Input parameter. Handle to the proxy address generation session as returned by the RcInitProxies Function.
Input parameter. Pointer to a RECIPIENTINFO Structure containing details about this recipient. The RECIPIENTINFO Structure is defined in the proxyinf.h header file.
Input parameter. An integer used to create a unique proxy address. Typically this is the number of times this function has previously been called for this recipient. If the remote system does not support this, it can be ignored. For a given recipient, this parameter will be zero the first time Exchange calls this function.
Output parameter. The proxy address that was generated for the recipient, in the format expected by the destination system. This must be a Unicode string of the form "TYPE:VALUE".

Return Value

Return Code, as defined in retcode.h. Only the following return codes are recognized by Microsoft Exchange.

RC_SUCCESS Return this code to indicate success.
RC_MEMORY Return this code to indicate that an error occurred while allocating memory.
RC_ERROR Return this code to indicate that some other error occurred.


If RcGenerateProxy is unable to create the proxy address, it should return RC_ERROR. This might occur when required information about the site or recipient is missing from the request, or if the address is already in use. When RcGenerateProxy returns RC_ERROR, Exchange will increment the nRetries parameter and call RcGenerateProxy again with the same RECIPIENTINFO Structure. RcGenerateProxy should then use the nRetries parameter to generate a unique address. For example, if MailUser is already in use, MailUser1 might be available. If Exchange continues to request proxy addresses with nRetries values larger than those supported by the remote system, the RcGenerateProxy should continue to return RC_ERROR. Exchange may make up to 20 requests of this type.

The following lists some of the common reasons why your dynamic-link library (DLL) might return RC_ERROR.

  • The value of the nRetries parameter is too high.
  • Site-specific information is incomplete.
  • Recipient information is incomplete.

You must call the RcInitProxies Function before you call RcGenerateProxy.

RcGenerateProxy uses the pRecipientInfo and nRetries parameters, and the site's proxy information to generate a site-unique recipient proxy address in the addressing format of the remote system.

RcGenerateProxy allocates memory for the ppszProxyAddr return parameter. If you write a program that uses the proxy generation DLL, call the FreeProxy Function to release the allocated memory.

The RcGenerateProxy function should not display any user interface, because proxy generation should be performed silently.

Test programs and other applications that use the proxy generation DLL can use the proxyinf.h, retcode.h, and proxygen.h header files that define proxy generation DLL interfaces, structures, and return codes.