Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8162025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:37:17+00:00 2026-06-06T18:37:17+00:00

The System.Messaging.MessageQueue class does not provide a way to set ownership of queue. How

  • 0

The System.Messaging.MessageQueue class does not provide a way to set ownership of queue. How do I programmatically set the owner of a MSMQ message queue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:37:18+00:00Added an answer on June 6, 2026 at 6:37 pm

    The short answer is to p/invoke a call to the windows api function MQSetQueueSecurity

    void SetOwner(MessageQueue queue, byte[] sid, bool ownerDefaulted = false)
    {
        var securityDescriptor = new Win32.SECURITY_DESCRIPTOR();
        if (!Win32.InitializeSecurityDescriptor(securityDescriptor, Win32.SECURITY_DESCRIPTOR_REVISION))
            throw new Win32Exception();
    
        if (!Win32.SetSecurityDescriptorOwner(securityDescriptor, sid, ownerDefaulted))
            throw new Win32Exception();
    
        if (Win32.MQSetQueueSecurity(queue.FormatName, Win32.OWNER_SECURITY_INFORMATION, securityDescriptor))
            throw new Win32Exception();
    }
    

    A complete class which defines a SetOwner extension method on System.Messaging.MessageQueue can be found on github

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the System.Messaging classes, how do I move a msmq message (in this case
I've implemented a system in C# that uses the Microsoft Message Queue ( System.Messaging
I have a basic messaging system set up and I m using the same
I have a micropost/messaging system and each time a new micropost or comment/message is
Am creating a messaging system model after facebook's messages. The message inbox is threaded,
I'm trying to set up a messaging system where a user's messages are displayed
I'm creating a messaging system for use in an XNA game. My Message types
I'm developing a messaging system on a website. When user sends a message, she
I am building a messaging system for a CMS and can not find a
I am trying to set up a messaging system similar to facebook where you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.