Partager via


PROPID_M_SENDERID_TYPE

 

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 PROPID_M_SENDERID_TYPE property specifies the type of sender identifier found in PROPID_M_SENDERID. It can also be used to tell Message Queuing to not attach the sender identifier to a message when the message is sent.

Property ID

PROPID_M_SENDERID_TYPE

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

This property can have one of the following values:

MQMSG_SENDERID_TYPE_SID

The default. PROPID_M_SENDERID contains the security identifier (SID) of the user sending the message.

MQMSG_SENDERID_TYPE_NONE

No identifier is attached to the message.

Remarks

To specify the type of sender identifier you want to send with the message, set PROPID_M_SENDERID_TYPE in the MQMSGPROPS structure and call MQSendMessage.

The sending application can tell Message Queuing not to authenticate who sent a message by specifying MQMSG_SENDERID_TYPE_NONE when it sends the message. This setting tells Message Queuing to not attach the SID to PROPID_M_SENDERID. However, if the sender identifier is not sent with the message, the destination queue must be able to accept messages from everyone.

To find out what type of sender identifier was sent with the message, include PROPID_M_SENDERID_TYPE in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value. When retrieving this property, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

A SID of a local user (a user not logged on to a Windows® 2000 or Windows Server 2003 domain) is valid only locally. Even if a local user specifies a SID, it is not sent with the message.

Equivalent COM Property

With COM components, the equivalent property for setting and retrieving the sender identifier type is MSMQMessage.SenderIdType.

Example Code

The following code fragment shows how PROPID_M_SENDERID_TYPE is specified in arrays that can be used to initialize an MQMSGPROPS structure.

aMsgPropId[i] = PROPID_M_SENDERID_TYPE;           // Property ID  
aMsgPropVar[i].vt = VT_UI4;                       // Type indicator  
aMsgPropVar[i].ulVal = MQMSG_SENDERID_TYPE_NONE;  // No SID attached  
i++;  

The following example is included in Using Message Queuing.

For an example of See
Retrieving the sender identifier from authenticated messages C/C++ Code Example: Validating Authentication

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MQSendMessage
PROPID_M_SENDERID
PROPID_M_SENDERID_LEN