Script in Rule

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Created a rule which runs a script. Script reads a mail and creates a
Calendar entry (appointment), for current user only, based upon mail content.
A prompt appears before script will run:


A program is trying to access e-mail addresses ... Do you want to allow
this ?

Is there a way to allow the script to run without forcing the user to
respond to this prompt ?
 
In Outlook 2003, a "run a script" rule should use this format:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

For OUtlook 2002, see http://www.outlookcode.com/d/sec.htm for your options.
I

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Solved the problem.

Thanks

Sue Mosher said:
In Outlook 2003, a "run a script" rule should use this format:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.SUbject

Set olMail = Nothing
Set olNS = Nothing
End Sub

For OUtlook 2002, see http://www.outlookcode.com/d/sec.htm for your options.
I

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top