Solved

Centrally manager folder creation and server-side rules for outlook 2007 users mailboxes

Posted on 2011-03-08
12
503 Views
Last Modified: 2013-11-05
We run exchange 2007 with outlook 2007 clients and need to centrally create and manage server-side rules for users and to also create specific folders under their INBOX.

Can this be done without having to setup the server-side rules and create the folders locally at each outlook 2007 client?
0
Comment
Question by:tdwhelp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
12 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 35078631
Hi, tdwhelp.

I am not enough of an Exchange expert to know if it is possible to do this at the server.  Depending on the rules I can probably do it at the client via a script.  I know I can create the folders via a script at the client.
0
 

Author Comment

by:tdwhelp
ID: 35083328
IF Exchange can centrally manage that, I would certainly prefer it.  

But a script would be helpful if that is possibility as well, as plan B.  Do you have an example of it?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35083434
I have an example of creating folders.  I'd need to put one together for creating rules.  I don't mind doing that.  The script will be more useful if you can give me an example of what you'd like a rule to do.  There are lots of variations on rules, so a sample I put together blindly may not be of much value to you.
0
Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

 

Author Comment

by:tdwhelp
ID: 35087500
RULE example:

emails from helpdesk@<domain>.com will get placed into a folder called "helpdesk" under INBOX.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35088907
This should do it.  This script will only work in Outlook 2007 and 2010.  It demonstrates how to create a folder and how to create a rule.  Follow these instructions to use it.

1.  Open Notepad
2.  Copy the code and paste it into Notepad
3.  Edit the code per the comments I included in it
4.  Save to a .vbs file

To test the code simply double-click the saved .vbs file.

You can include this code in a logon script or run it from a group policy.  Either approach will allow you to add folders and rules centrally.  The script could even be enhanced to check for the existence of certain rules/folders and create them if they are missing.  
'Define some constants'
	Const olFolderInbox = 6
	Const olRuleReceive = 0

'Define some variables'
	Dim olkApp, olkSes, olkFld, olkAll, olkRul, olkCon, olkAct
	
'Connect to Outlook'
	Set olkApp = CreateObject("Outlook.Application")
	Set olkSes = olkApp.GetNamespace("MAPI")
	olkSes.Logon olkApp.DefaultProfileName

'Add a folder under the Inbox'
	'Repeat the next line for each folder you want to add.  Change the folder name on the next line.'
	olkSes.GetDefaultFolder(olFolderInbox).Folders.Add("Some Name")

'Create a rule.  Repeat this block of code (down to but not including Clean up) for each rule you want to add.'
	
	'Get the exiting rules'
	Set olkAll = olkSes.DefaultStore.GetRules
	
	'Add a new rule'
	'Change the rle name on teh next line'
	Set olkRul = olkAll.Create("Rule Name", olRuleReceive)
	
	'Create the rule condition'
	Set olkCon = olkRul.Conditions.From
	With olkCon
		.Enabled = True
		'Change the email address on the next line'
		.Recipients.Add "helpdesk@domain.com"
		.Recipients.ResolveAll
	End With

	'Create the rule action'
	Set olkAct = olkRul.Actions.MoveToFolder
	With olkAct
		.Enabled = True
		'Change the folder name on the next line'
		.Folder = olkSes.GetDefaultFolder(olFolderInbox).Folders("HelpDesk")
	End With
	
	'Save the new rule'
	olkAll.Save True

'Clean up'
	olkSes.Logoff
	Set olkAct = Nothing
	Set olkCon = Nothing
	Set olkRul = Nothing
	Set olkAll = Nothing
	Set olkFld = Nothing
	Set olkSes = Nothing
	Set olkApp = Nothing

Open in new window

0
 
LVL 76

Expert Comment

by:David Lee
ID: 35088940
I should have added that a rule is either server side or client side based on how it works.  Certain conditions and actions only work at the client.  The rule you gave should be a server side rule.
0
 

Author Comment

by:tdwhelp
ID: 35099150
Blue Devil Fan,

Thank you for your script, it creates the folder but errors out at line 44 character 2.  It can't save because "one or more rules cannot be saved because of invalid actions or conditions".

any ideas?  my rule being named "helpdesk" inside the VB script.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35099243
M fault.  I left off part of the command on 40.  It should read

    Set .Folder = olkSes.GetDefaultFolder(olFolderInbox).Folders("HelpDesk")
0
 

Author Comment

by:tdwhelp
ID: 35139876
BlueDevilFan:

can we modify the vb script so it ONLY creates a rule that where the condition is "sent to people or distribution list" such as the helpdesk@domain.com?  I think this rule condition may be a better fit.

What I now think may work better, is that I set the helpdesk mailbox so it copies a group of IT staff on messages send to the helpdesk mailbox, then when that message arrives at the IT staff mailbox, "helpdesk@domain.com" will be in the TO: or CC: line and the email will get filtered by that and directed into the "helpdesk" folder that your vb script created.

0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 35142540
Sure.  Try this.  Replace the code you have now with the version below.
'Define some constants'
    Const olFolderInbox = 6
    Const olRuleReceive = 0

'Define some variables'
    Dim olkApp, olkSes, olkFld, olkAll, olkRul, olkCon, olkAct
    
'Connect to Outlook'
    Set olkApp = CreateObject("Outlook.Application")
    Set olkSes = olkApp.GetNamespace("MAPI")
    olkSes.Logon olkApp.DefaultProfileName

'Add a folder under the Inbox'
    'Repeat the next line for each folder you want to add.  Change the folder name on the next line.'
    olkSes.GetDefaultFolder(olFolderInbox).Folders.Add ("Some Name")

'Create a rule.  Repeat this block of code (down to but not including Clean up) for each rule you want to add.'
    
    'Get the exiting rules'
    Set olkAll = olkSes.DefaultStore.GetRules
    
    'Add a new rule'
    'Change the rule name on the next line'
    Set olkRul = olkAll.Create("Rule Name", olRuleReceive)
    
    'Create the rule condition'
    Set olkCon = olkRul.Conditions.SentTo
    With olkCon
        .Enabled = True
        'Change the email address on the next line'
        .Recipients.Add "helpdesk@domain.com"
        .Recipients.ResolveAll
    End With

    'Create the rule action'
    Set olkAct = olkRul.Actions.MoveToFolder
    With olkAct
        .Enabled = True
        'Change the folder name on the next line'
        Set .Folder = olkSes.GetDefaultFolder(olFolderInbox).Folders("HelpDesk")
    End With
    
    'Save the new rule'
    olkAll.Save True

'Clean up'
    olkSes.Logoff
    Set olkAct = Nothing
    Set olkCon = Nothing
    Set olkRul = Nothing
    Set olkAll = Nothing
    Set olkFld = Nothing
    Set olkSes = Nothing
    Set olkApp = Nothing

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question