共用方式為


MSMQMessage.SenderId

 

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 SenderId property of the MSMQMessage object is an array of bytes that represents the identifier of the sending user. Typically, Message Queuing sets this property when the message is sent.

Data type: Variant (array of bytes)
Run-time access: Read/write
Property SenderId As Variant  

Property Value

An array of bytes generated by Message Queuing.

Remarks

SenderId is set by MSMQ, and is used primarily by the destination queue manager when authenticating a message. The destination queue manager uses the sender identifier in this property to verify who sent the message and to verify that the access rights for placing messages in the destination queue are allowed for the sender.

By default, Message Queuing sets this property when a message is sent. However, Message Queuing will not attach the sender identifier to the message if the sending application has set MSMQMessage.SenderIdType to MQMSG_SENDERID_TYPE_NONE, indicating that the sending application does not want Message Queuing to validate who sent the message.

The receiving application can use SenderId to retrieve information about who sent the message. However, the information in SenderId is only trustworthy if the message was authenticated.

Connector applications must provide the sender identification when sending message. In this case, SenderId and MSMQMessage.ConnectorTypeGuid must be set. SenderId is ignored if MSMQMessage.ConnectorTypeGuid is not also set when the message is sent.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_SENDERID.

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

MSMQMessage
MSMQMessage.SenderIdType
PROPID_M_SENDERID