共用方式為


MSMQQueueInfo.QueueGuid

 

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

The QueueGuid property of the MSMQQueueInfo object identifies the public queue associated with the MSMQQueueInfo object. The queue identifier is created by Message Queuing when the queue is created.

Data type: String (GUID format)
Run-time access: Read-only
Property QueueGuid As String  

Property Value

A String containing the GUID of the public queue in the form {12345678-1234-1234-1234-123456789ABC}.

Note

Notice the presence of the braces normally used with GUIDs.

Remarks

Message Queuing sets QueueGuid when the queue is created. This property identifies the queue defined by the MSMQQueueInfo object. It does not identify an open instance of the queue.

The QueueGuid property can be used as search criteria when making a query of existing public queues. See the MSMQQuery.LookupQueue method for details on running a query.

To retrieve the GUID of a queue, your application must first obtain an MSMQQueueInfo object that represents the queue. This object can be returned by a query using the MSMQQuery.LookupQueue method or created by the sending or receiving application.

Before using an application-created MSMQQueueInfo object, the application must initialize it to reference the queue by setting its MSMQQueueInfo.PathName or MSMQQueueInfo.FormatName property. Setting the FormatName property with a cached public format name instead of the PathName property frees Message Queuing from the need to retrieve information stored in the directory service to generate this format name.

To retrieve the stored GUID of a queue, call the MSMQQueueInfo.Refresh method and inspect the MSMQQueueInfo.QueueGuid property. Message Queuing stores the identifier in the directory service (for public queues) and on the local computer (for private queues). The property values of an MSMQQueueInfo object are not updated with the values stored by Message Queuing until the MSMQQueueInfo.Refresh method is called.

Equivalent API Function Property

With function calls, the equivalent property is PROPID_Q_INSTANCE.

Example Code

The following example is included in Using Message Queuing.

For an example of See
Retrieving the GUID identifier of an existing queue Visual Basic Code Example: Retrieving MSMQQueueInfo.QueueGuid

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

MSMQQueueInfo
MSMQQueueInfo.Refresh
PROPID_Q_INSTANCE