Office 2013 and later

Last modified: July 23, 2011

Applies to: Outlook

In this article
Quick Info
Return Values

Returns an Extensible Markup Language (XML) stream that represents information retrieved from the auto-discovery service of a Microsoft Exchange 2007 server.

Exported by:


Called by:


Implemented by:


HRESULT HrGetAutoDiscoverXML( 
    __in_z const WCHAR *pwzAddress, 
    __in_opt_z const WCHAR *pwzPassword, 
    __in_opt HANDLE hCancelEvent, 
    __in_opt ULONG ulFlags, 
    __out IStream** ppXmlStream); 


[in] A null-terminated Simple Mail Transfer Protocol (SMTP) e-mail address of the account for which you want to retrieve the auto-discovery information.


[in] An optional password for the account specified by pwzAddress. Note that passing any password has no effect if the account specified by pwzAddress does not require a password.


[in] An unset Win32 event handle that is optional and can be used to cancel the operation. To cancel the operation, set the event and pass the event handle as hCancelEvent; pass null if you do not want to cancel the operation. Note that passing a value that does not represent an event handle has no effect and is ignored by the function.


[in] This parameter is not used. It must be 0.


[out] A pointer to an IStream object that contains the autodiscovery XML. Returns null if the autodiscovery operation fails. You must release the IStream object when you are finished with it.


  • The function call is successful.


  • pwzAddress is null or is not a valid SMTP address, or ppXmlStream is a null pointer to an IStream object.


  • Client computer is not connected to the network, client computer is not connected to a Microsoft Exchange 2007 server, pwzAddress is not an account on an Exchange 2007 server, or pwzAddress is an account that does not support Exchange auto-discovery service.


  • An event handle has been passed to hCancelEvent to cancel the operation.


  • The value passed to pwzAddress or pwzPassword is too long, such that it overflows the internal buffer of size 256 bytes.