MessagePropertyFilter.SenderId 属性

定义

获取或设置一个值,该值指示接收或查看消息时是否检索 SenderId 属性信息。

public:
 property bool SenderId { bool get(); void set(bool value); };
[System.Messaging.MessagingDescription("MsgSenderId")]
public bool SenderId { get; set; }
[<System.Messaging.MessagingDescription("MsgSenderId")>]
member this.SenderId : bool with get, set
Public Property SenderId As Boolean

属性值

如果接收 SenderId 信息,则为 true;否则为 false。 默认值为 false

属性

示例

下面的代码示例演示如何使用 SenderId 属性。

// Set the queue's MessageReadPropertyFilter property 
// to enable the message's SenderId property.
queue->MessageReadPropertyFilter->SenderId = true;

// Peek at the message. Time out after ten seconds 
// in case the message was not delivered.
orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0));

// Display the value of the message's SenderId property.
Console::WriteLine("Message.SenderId: {0}", 
    orderMessage->SenderId);
// Set the queue's MessageReadPropertyFilter property to enable the
// message's SenderId property.
queue.MessageReadPropertyFilter.SenderId = true;

// Peek at the message. Time out after ten seconds in case the message
// was not delivered.
orderMessage = queue.Peek(TimeSpan.FromSeconds(10.0));

// Display the value of the message's SenderId property.
Console.WriteLine("Message.SenderId: {0}",
    orderMessage.SenderId);

注解

SenderId类的 Message 属性主要由接收队列管理器在对消息进行身份验证时使用。 属性由消息队列设置,队列管理器使用来验证发送消息的人员以及发送者是否有权访问接收队列。

适用于

另请参阅