Updated: July 19, 2016

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

(Introduced in MSMQ 3.0.) The MQADsPathToFormatName function translates the ADs path of a queue, queue alias, or distribution list into a format name.

  LPCWSTR lpwcsADsPath  
  LPWSTR lpwcsFormatName  
  LPDWORD lpdwFormatNameLength  


[in] Pointer to a String that contains the ADs path.


[out] Pointer to a buffer to receive the format name for the queue.

System_CAPS_ICON_note.jpg Note

For definitions of terms in italics, see the Message Queuing Glossary.


[in, out] On input, specifies the length of the lpwcsFormatName buffer (in Unicode characters). Public queues require at least 44 Unicode characters; private queues require at least 54. NULL pointer is not allowed.

On output, indicates the length of the returned format name string, including the null-terminating character. If the output value is greater than the initial input value, the supplied buffer is not large enough to contain the complete format name string and MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL is returned. In this case, only a portion of the format name is returned.

For queue aliases, the returned format name can be a direct, public, or private format name. The returned format name is the format name of the queue that the alias represents.

When using COM components, you can obtain the format name of a public queue, queue alias, or distribution list from the ADs path by setting the MSMQDestination.ADsPath property and then retrieving the MSMQDestination.FormatName property.

Windows NT/2000/XP: Included in Windows XP and Windows Server 2003.

Windows 95/98/Me: Unsupported.

Header: Declared in Mq.h.

Library: Use Mqrt.lib.

Message Queuing Functions

Community Additions