Link to home
Start Free TrialLog in
Avatar of Giovanni A
Giovanni A

asked on

VBA to create a rule for each unique sender in a folder

My company run Exchange server 2016 and Outlook 2016
Some users have have many (hunderds) of folder in their inbox keeped updated manually. I want to automatically create rules to keep their structure updated.

Let me expain with an exemple:

(inbox) exemple@mycompany.com
- Folder Clients
> Sub folder A
>> mail from exemple1@a.com
>> mail from exemple2@a.com
>> mail from exemple1@a.com
> Sub folder B
>> mail from exemple1@b.com
> Sub foldder C
- Folder suppliers


Selecting a folder I want to automatically create rules for all subfolders. In this exemple selecting the root I want to create those rules:
1) move mail from exemple1@a.com or exemple2@a.com to folder clients/A
2) move mail from exemple1@b.com to folder clients/B
Avatar of zvitam
zvitam
Flag of Israel image

VBA is not the right way to implement such rules.

The rules should be on the server side,and I think the right tool for this implementation is Powershell as described in the following atricle:

Managing users’ Outlook rules from Exchange Management Shell (with PowerShell)
Avatar of Giovanni A
Giovanni A

Probably I did not explain well my intent.

I have to create a ton of rules for any user. This will take too mouch time both by gui and by powershell. Since All the rule I want to create have the same logic I want to automate their creation.

Theorically I also can create a script that generates the powershell command and then execute them by powershell. I think is more difficult but is also ok if you can help me in that.

Let me expain with an exemple:

inbox exemple@mycompany.com
folders
- Clients
> A
>> mail from exemple1@a.com
>> mail from exemple2@a.com
>> mail from exemple1@a.com
> B
>> mail from exemple1@b.com
> C
- suppliers


I want to automatically create those rules:
1) move mail from exemple1@a.com or exemple2@a.com to folder clients/A
2) move mail from exemple1@b.com to folder clients/B
Please also consider that with outlook 2016 and exchange 2016 I expect client side rules compatible with exchange server (like the described ones)  to automatically move to exchange. This works in my tests
Avatar of Giovanni A

ASKER

I updated the request. I hope it is more easy to understand what I need
ASKER CERTIFIED SOLUTION
Avatar of Neil Fleming
Neil Fleming
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial