Outlook 2013 - Script to Create Rule to Delay All Sent Messages by X Minutes

I'm able to manually create such a rule via the wizard in Outlook, but I need to deploy this rule to 50+ workstations.  Since exporting and importing rules via script seems like a dead end, what about just re-creating the rule via script?  That should be easy enough to deploy via Group Policy.  Any experts want to way in on this?
TheBLainNetwork AdministratorAsked:
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.

Will SzymkowskiSenior Solution ArchitectCommented:
What you could do here is create an Outlook rule using Powershell (see link below)
http://blogs.technet.com/b/heyscriptingguy/archive/2009/12/16/hey-scripting-guy-december-16-2009.aspx

Once you have the script configured you can then deploy this via GPO logon script.

Thats how you can deploy this to multiple users.

Will.
0
Dirk MareSystems Engineer (Acting IT Manager)Commented:
I would do this at Server level are you using Exchange? I know MailMarshal can also do this.

DirkMare
0
TheBLainNetwork AdministratorAuthor Commented:
Will - I didn't know PowerShell was an option for this!  That's awesome as it's standardized across the network and easy to deploy.  May take a bit to figure out exactly how to script it, but the example you posted looks quite similar to the VB code I already have.

Dirk - We are indeed running Exchange, but I was under the impression that delaying messages was not possible at that level (at least not with standard transport rules).  Is there something I'm missing?
0
TheBLainNetwork AdministratorAuthor Commented:
Will - Looks like rules with deferred delivery/delayed send cannot be created programmatically (per MS).

We ended up creating a VBA script that runs as a background macro in Outlook (see code below).  If "immediate" is in the subject line it sends immediately as usual, if not it delays send by 5 minutes.  This parks it in the Outbox, allowing users to make any needed corrections before it sends for good.

As for deployment, we push out a pre-configured Outlook OTM (macro) file.  Not the most elegant solutions to be sure, but it works for now.

Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim objMailItem As MailItem       ' to hold mail item
  Dim intErrNumber As Integer
  '
  On Error GoTo Err_Handler         'Error Handling
  Set objMailItem = Item            'Set object to mail item just sent
  'If objMailItem.Subject <> "Immediate" Then
  If InStr(1, objMailItem.Subject, "Immediate", vbTextCompare) = 0 Then
    objMailItem.DeferredDeliveryTime = DateAdd("n", 5, Now)     'Delay is + 2 minutes
   End If
  Exit Sub
Err_Handler:
'Due to lack of concentration of the code writing genius there has been a bit of an error,
'  lets tell someone about it by popping up a message box with a detailed description on the screen.
  intErrNumber = Err.Number
  If intErrNumber = 13 Then
   'Nothing.
  Else
    MsgBox ("An error has occurred on line " & Erl & ", with a description: " & Err.Description & ", and an error number " & _
       Err.Number)
  End If
End Sub

Open in new window

0

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
TheBLainNetwork AdministratorAuthor Commented:
Sometimes pre-packaged solutions are simply unavailable, and you need to craft something from scratch.  Such was the case here.
0
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
Outlook

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.