⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Relating to an issue (#51668) , now resolved, regarding setting broker properties.
I am unable to set the 'Label' property in a service bus message.
Building on the code from from the previous feedback:
``
from azure.servicebus import ServiceBusClient, Message
CONNECTION_STR = ''
QUEUE_NAME = 'queue`'
sb_client = ServiceBusClient.from_connection_string(conn_str=CONNECTION_STR)
queue_sender = sb_client.get_queue(queue_name=QUEUE_NAME)
message = Message("{'data':'Hello World!'}")
message.user_properties = {'Label': 'Shell.Energy.Europe.Power.Meter.Actual'}
message.properties.content_type = "application/json"
message.properties.label = "M4"
queue_sender.send(message)
``
The result is that the ContentType is set as "application/json", however the Label property remains empty. I am able to set other properties such as 'ReplyTo' so Am not sure why the Label can't be set this way too?
Any help is much appreciated, thanks
Thanks for the feedback and bringing this to our notice . At this time we are reviewing the feedback and will update the document as appropriate .
Any update on this? thanks
I figured it out! instead of properties.label, it should be properties.subject
@izzy1993 Glad to hear that! We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.