共用方式為


MSMQDestination.ADsPath

 

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 ADsPath property of the MSMQDestination object, which can represent one or more queues, specifies the ADs path to a distribution list, public queue, or queue alias object stored in Active Directory Domain Services (AD DS).

Setting this property initializes the MSMQDestination object for sending messages.

Data type: String
Run-time access: Read/write
Property ADsPath As String  

Property Value

A String that contains the ADs path to a distribution list, public queue, or queue alias object stored in AD DS.

The following example shows a possible ADs path of the public queue "MyComputer\MyQueue".

LDAP://MyLDAPServer/CN=MyQueue,CN=msmq,CN=MyComputer,CN=Computers,DC=MyDomain,DC=MyCompany,DC=COM  

Remarks

Setting the ADsPath property initializes the MSMQDestination object so that the object can be opened explicitly by calling MSMQDestination.Open or implicitly by referencing the object in MSMQMessage.Send and closes the object if it is open.

Setting the ADsPath property also sets the MSMQDestination.FormatName property. Message Queuing generates the appropriate format name for the distribution list, public queue, or queue alias from the ADs path.

However, private queues cannot be explicitly referenced with ADsPath. To reference a private queue, create a queue alias for the private queue and reference the ADs path of the alias, or use the MSMQDestination.FormatName or MSMQDestination.PathName property.

The ADsPath property is a string, and Message Queuing COM components ignore any characters that follow the first Null character in a string without returning an error.

Equivalent API Function

The equivalent API function for generating the appropriate format name for a distribution list, public queue, or queue alias from the ADs path is MQADsPathToFormatName.

Example Code

The following code fragment illustrates how to initialize an MSMQDestination object by specifying an ADs path to the public queue "MyComputer\MyQueue" in the ADsPath property.

Dim dest As New MSMQDestination  
dest.ADsPath = "LDAP://MyLdapServer/CN=MyQueue,CN=msmq,CN=MyComputer,CN=Computers,DC=MyDomain,DC=MyCompany,DC=COM"  

The following code fragment illustrates how to initialize an MSMQDestination object by specifying an ADs path to the distribution list "MyDL" in the ADsPath property.

Dim dest As New MSMQDestination  
dest.ADsPath = "LDAP://MyLdapServer/CN=MyDL,OU=MSMQDLs,DC=MyDomain,DC=MyCompany,DC=COM"  

Note

"MSMQDLs" is the name of a user-defined container (organizational unit) for distribution lists.

The following code fragment illustrates how to initialize an MSMQDestination object by specifying an ADs path to the queue alias "MyQueueAlias" in the ADsPath property.

Dim dest As New MSMQDestination  
dest.ADsPath = "LDAP://MyLdapServer/CN=MyQueueAlias,OU=Domain Controllers,DC=MyDomain,DC=MyCompany,DC=COM"  

The following examples are included in Using Message Queuing.

For an Example of See
Sending messages using a distribution list Visual Basic Code Example: Sending Messages Using Distribution Lists
Creating a queue alias Visual Basic Code Example: Creating a Queue Alias

Requirements

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

Windows 95/98/Me: Unsupported.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib

See Also

MSMQDestination
MSMQDestination.FormatName
MSMQMessage.Send