The label property of an MSMQ message has been used for many things. Developers still use the label property and want to continue to use it. So, how do you get access to this property in WCF before posting your message to the queue.
It turns out that if you are using the NetMSMQBinding you can’t. After thinking about this a bit it makes sense since the NetMSMQBinding only uses MSMQ as an transport mechanism between two endpoints. In this case any data you want to send between these two endpoints needs to be in the message body. This is so your endpoints can be agnostic to the underlying transport and allow you to swap it out without having to modify your code.
To be able to utilize the label property you need to use the MsmqIntegrationBinding. The MsmqIntegrationBinding class enables WCF to use the types defined in the System.Messaging namespace. The label property is on the MsmqIntegrationMessageProperty class which can be used as follows:
MsmqIntegrationMessageProperty property = MsmqIntegrationMessageProperty.Get(message);
string lbl = property.Label