read message queue sent time from MSMQ Journal

[Originally posted by]:

I have an MSMQ with an enabled Journal. And due to the fact that we receive more than 1000 messages per day I want to clear the Journal to keep only the messages from last 2 days. Therfore I want to read all messages and check their SentTime property against the “current date – 2 days”. But at the moment the program will stop as the Property SentTime wont be provided.

Error: “PropertyFilter isn’t set correctly”

The code:

class Program {

    static void Main(string[] args) {

        string queueName = ".\\private$\\TEST;journal";

        MessageQueue msgQueue = new MessageQueue(queueName);
        Message[] messages = msgQueue.GetAllMessages();


            foreach (Message msg in messages){
                //if(msg.SentTime < DateTime.Today.AddDays(-2)){

        }catch (Exception e){






Why do I have no access to the Property? Who can help? Thanks a lot!


You can use


and it will set all filter properties to true.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s