C# – MSMQ COM API in C#

ccommsmq

What is the best way to use MSMQManagement from C#? I need the ability to peek and purge a local outgoing queue when the remote machine is disconnected.

Apparently some users can do this through the COM API, but in the COM References tab, I don't have the "Microsoft Message Queue 3.0 Object Library" that other websites/blogs/postings mention (nor anything remotely similar). I've searched the machine for Interop.MSMQ.dll and cannot find it either.

We are using VS 2008 and running on Windows 7 64-bit.

What am I missing? Are there other mechanisms to accomplish this through "normal" managed classes?

Thanks

Best Answer

Project + Add Reference, Browse tab. Navigate to c:\windows\system32 (or syswow64 on a 64-bit operating system) and select mqoa30.tlb. This creates the Interop.MSMQ.dll interop assembly you are looking for. Beware that MSMQ is an optional Windows component, you'll need to install it first if the file isn't present on your machine.

Related Topic