Setting up rules based on distribution lists...

Hello Experts,

I ran into trouble with the 32k rules limit built into Outlook / Exchange.

The answer appeared to be to setup distribution lists and make rules for each list rather than for individual people.

So I did...

But Outlook tells me that my distribution list is a "personal" one and as such is not acceptable for use in a rule.

How do I sort that out?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Are the existing rules wholly on the server at the moment?  If so, could you move some to the client?

Just an idea: there are many companies offering third party add-ins for Exchange (eg GFI:  If you can find one of more add-ins that replace some of your rules this would enable you to delete these rules and add the ones you need (does that make sense?).
OzoneFriendlyAuthor Commented:
I thought I'd commented on this question, but clearly I have not :-)

I believe I have cleared out the old rules. Microsoft tell me that the correct solution to the problem is to use distribution lists to create rules.

Plus, that makes rules maintenance easy, as I can just add people to the relevant list :-)

So, the plan is to get these lists working :-)

Good solution - makes sense.  Post back to let us know how you get on!
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

OzoneFriendlyAuthor Commented:
Yes, actually thats the point of the original question... I can't get it working... :-)

I think the idea is that you apply the rule in Exchange to the distribution list not at the client.
OzoneFriendlyAuthor Commented:
OIC. Okay, lemme see if I can muddle through that, and I'll get back to you.
OzoneFriendlyAuthor Commented:
Okay, one more attempt at answering this before I go insane :-)

I couldn't figure out how to setup any sort of filtering in Exchange.

Can someone give me a hint? :-)
David LeeCommented:

Can you share a few more details, please?  What version of Outlook are you using?  How are the dist lists set up?  Are they on the server or your PC?  Are the members in your Contacts, or are they member of the GAL, or a mixture of the two?
OzoneFriendlyAuthor Commented:
Okay, no problemo.

I am running Outlook 2003.

The Distribution List is in my Public Address Book. I just created it and added a bunch of address' to it.

Perhaps part of my problem is that the list is in the public address book? The problem is that the public address book is public because all of my staff need access to those contacts, and those are the contacts I need to organise rules for.

The members of the list should all be in the public address book also. I don't know much about the global address list, perhaps I should ?

Hopefully that clarifies things a bit ?
OzoneFriendlyAuthor Commented:
I just removed all the members of the list and re-added the ones I wanted (as I have recently cleaned up the public contacts folder in question).

I then tried to create a rule using that list, and I get;

'Suppliers' is a personal distribution list that may not be used with this feature. Would you like to use the individual members of 'Suppliers' instead?

David LeeCommented:
Ok, so the dist list is in a public folder, right?  The global address list is all the members of your email organization plus any outsiders that entries have been created for.  The GAL does not include the contents of otehr address containers such as Contacts or contact containers in public or private folders.
OzoneFriendlyAuthor Commented:
Yes, thats right.

Do I need to use the GAL to achieve the result?
David LeeCommented:
I've never tried a rule based on a dist list, so I'm not prepared to say yet.  I'll try that today, using various dist lists and let you know.
OzoneFriendlyAuthor Commented:
Am I having any luck with this issue? :-)
David LeeCommented:
No, I'm afraid not.  When I try to base a rule on the list I Outlook pops up a dialog-box saying that the list cannot be used in this type of rule.  It offers me the option of using the list members instead of the list itself.  I see two ways around this.  One, move the contacts and the list to a contact folder in your mailbox.  Two, move the contacts into the GAL as ? (I can't remember the term, something like internet mail recipient).  
OzoneFriendlyAuthor Commented:
Moving the contacts to a contacts folder in my mailbox doesn't fix it.

Do you know how to acces the Global Address List? Can I even create contacts there, I thought that was for Exchange Mailbox stuff only.

Is there a way to filter mail at the server before Outlook even see's it?

I hope Microsoft are reading this, you pay for a big fancy server solution and you can't do something as simple as filter your email!

David LeeCommented:
Good morning, Matthew.

Hmmmm.  I'll test the contacts folder approach and let you know if I different results.  If you aren't an Exchange administrator, then you can't add anything to the GAL yourself.  You'd have to rely on your Exchange admin for that.  

> Is there a way to filter mail at the server before Outlook even see's it?
Yes.  There are actually two types of rules in Outlook, those that run at the server (Exchange) and those that run at the client (Outlook).  Server side rules run before you, or Outlook, ever see the message.  They are limited to doing things which can be done completely on the server.  When you create a rule Outlook inspects it and determines if it can run at the server or not.  If not, then Outlook pops up a dialog-box warning you that the rule is Client Only.  Here's a link to page at, a site specializing in Exchange/Outlook, that explains in more depth:  I don't think a rule that's filtering on a distribution list in a Personal or Public folder is going to be a server rule.  And in fact we have empirical evidence that we can't filter on a list in a Public folder at all.

> you pay for a big fancy server solution and you can't do something as simple as filter your email
Exchange gives you a lot of other capabilities that you wouldn't have with Outlook alone.  Don't get me wrong though, I'm not defending Microsoft here.  Exchange and Outlook both have some annoying problems and more than once I've wondered what the designers at Microsoft were thinking about when they made decisions on how both would work.  There might be other ways to solve this issue.  If you could describe a bit more about what sorts of conditions you want to filter on, then perhaps I could recommend an alternative to filtering on lists.
OzoneFriendlyAuthor Commented:
Hello Again BlueDevilFan,

Sorry for my whinging. Its just frustrating that something so simple is so hard, considering I have the alleged latest and greatest :-)

I am the guy responsible for the server, I just don't have all the skills :-)

If we refer back to the start of the question, my problem is;

I get email from lots of different people.

I want to have that email organised into folders depending on who sent the email

I can't create enough rules because there is a hard limit on the size of the rules I can create

That link you suggested tells me that I cannot create what I need on the server, because I want to move messages to a given folder. So We have to do it at the client.

But if I create enough rules on the client, Outlook will bork and not let me create any more. I haven't tried to count the number of people who email me and who's emails I want to organise, but its lots maybe as many as 300.

I've just started creating fresh rules as emails come in, but I expect that after a short while I will get the above error and be back to square one.

Hopefully I have explained my grief better, and hopefully there is a better answer. :-)

Thanks for all your help to date.


David LeeCommented:
I feel your pain, Mathew.  I'm frequently irritated with Microsoft's design decisions.  That aside, I'm not sure that trying to organize your messages in the way you described makes the most sense.  I can't imagine having to navigate so many different folders to find something.  Having the messages arranged by sender is great if you know who sent the message you're looking for, but it'd be a big pain to find a message if you're unsure of who sent it.  Personally, I find it more useful to file messages by subject or category.  I also tend to prefer to read my messages and then file them rather than leave it to rules to file them for me.  In all fairness though I don't know what you do or what sort of topics the messages you receive cover, so I don't know that my message handling approach is good for you.  If you can use something other than sender to categorize your messages, soemthing that would cut down on the number of rules needed to get your messages in order, than perhaps you could get under the 32K limit.  If not, or if arranging by sender is absolutely essential, then the only solution I know of to offer is writing your own rules via VBA.  To the best of my knowledge there is no practical limit to the number of rules you can construct in this fashion and they allow you to do things that just aren't possible using Outlook's rule's wizard.  It's not too difficult to put the code together for this.  I can post sample code and would be glad to help you get going.  These would be client-side rules, running only when Outlook is open and running.
OzoneFriendlyAuthor Commented:
Hello again.

So much pain.... :-)

I categorise my incoming emails by the TYPE of person who sent them;


with some other categories such as

Web Hosting
etc etc

I hear what you are saying, but the way I operate, this works a treat for me.

Sounds like the VBA thing is the way to go. My only worry there is how easy it will be to add email address' to the rules.

I would imagine we can have a rule for each folder, such as;

If sender = blah1 or blah2 or blah3 etc etc then move to folder XXXX

I could probably deal with the added work of adding address' to the rules because once most of them are done, I won't have to add new ones that often.

Okay, hook me up, what do I click on to create rules that way? Sample code GOOD :-)

Thanks heaps,
David LeeCommented:
Hi, Mathew.

> If sender = blah1 or blah2 or blah3 etc etc then move to folder XXXX
Yes, that's it exactly.  It's really not very difficult to do.  It is a bit of an inconvenience to have to open the VB editor in Outlook and add a line or two of code for a new rule, and you do lose the ability to right-click on a new message and create the rule directly.  In return though you gain the ability to create very complex rules, assuming you need them, and key on message properties that the rules wizard can't handle.  I'll post the sample code this evening.  
David LeeCommented:

Sorry but I'm not going to get around to posting the code tonight.  I should be able to get it posted tomorrow for sure.
OzoneFriendlyAuthor Commented:
No problems, I appreciate your help.
David LeeCommented:
Ok, here it is.

'Code Begins Here
Private WithEvents objInboxItems As Items
Private Sub Application_Startup()
    Set objInboxItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Application_Quit()
    Set objInboxItems = Nothing
End Sub
Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
    Dim objFolder As Outlook.MAPIFolder

    'Rule for messages from PersonA
    If Item.SenderEmailAddress = "" Then
        Set objFolder = OpenMAPIFolder("\Mailbox - Doe, John\SomeFolder\PersonA")
        Item.Move objFolder
        Set objFolder = Nothing
    End If

    'Rule for messages from PersonB
    If Item.SenderEmailAddress = "" Then
        Set objFolder = OpenMAPIFolder("\Mailbox - Doe, John\SomeFolder\PersonB")
        Item.Move objFolder
        Set objFolder = Nothing
    End If

    'Rule for messages with a specific subject
    If Item.Subject = "Some Subject" Then
        Set objFolder = OpenMAPIFolder("\Mailbox - Doe, John\SomeFolder\SubjectX")
        Item.Move objFolder
        Set objFolder = Nothing
    End If

    'Here is an alternative way of handling this.  This approach assumes that you will only key on the sender's email address.
    Select Case Item.SenderEmailAddress
        Case ""
            strFoldername = "\Mailbox - Doe, John\SomeFolder\PersonA"
        Case ""
            strFoldername = "\Mailbox - Doe, John\SomeFolder\PersonB"
    End Select
    Set objFolder = OpenMAPIFolder(strFoldername)
    Item.Move objFolder
    Set objFolder = Nothing
End Sub

'Credit where credit is due.
'The code below is not mine.  I found it somewhere on the internet but do
'not remember where or who the author is.  The original author(s) deserves all
'the credit for these functions.
Function OpenMAPIFolder(szPath)
    Dim app, ns, flr, szDir, i
    Set flr = Nothing
    Set app = CreateObject("Outlook.Application")
    If Left(szPath, Len("\")) = "\" Then
        szPath = Mid(szPath, Len("\") + 1)
        Set flr = app.ActiveExplorer.CurrentFolder
    End If
    While szPath <> ""
        i = InStr(szPath, "\")
        If i Then
            szDir = Left(szPath, i - 1)
            szPath = Mid(szPath, i + Len("\"))
            szDir = szPath
            szPath = ""
        End If
        If IsNothing(flr) Then
            Set ns = app.GetNamespace("MAPI")
            Set flr = ns.Folders(szDir)
            Set flr = flr.Folders(szDir)
        End If
    Set OpenMAPIFolder = flr
End Function

Function IsNothing(Obj)
  If TypeName(Obj) = "Nothing" Then
    IsNothing = True
    IsNothing = False
  End If
End Function
'Code Ends here

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OzoneFriendlyAuthor Commented:
Sorry for not getting back to you on this question, I've been so busy this month.  I'll have a play with this as soon as I can.
David LeeCommented:
No problem.  I understand completely.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.