J
James B
I am writing a junk mail filter script and whenever I run
it I get the warning about the script trying to access
email addresses stored in outlook, it then askes do I
want to allow this, if I click yes the script runs as it
should, if no then the item.body call fails.
my question is why are the contacts searched or accessed
when i try to only get the body of a message? and is
there anyway to stop this message from coming up?
perhaps by getting access to the item.body another way?
I'm using XP, Outlook 2003, VS.NET installed, outlook
security level set to very high, my script is self signed
and in the trusted pubs list in outlook.
script is below
Sub FilterZeroBodyMail()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set inbox = myNameSpace.GetDefaultFolder(6)
Set junk = myNameSpace.Folders("Personal
Folders").Folders("Junk E-mail")
intMessCount = inbox.Items.Count
'myFolder.Folders.Get("
For x = 1 To intMessCount
Set Item = inbox.Items(x)
Body = Item.Body ' <--- warning pops up here
Body = Replace(Body, vbCrLf, "")
If Len(Trim(Body)) < 2 Then
Item.Move (junk)
MsgBox "Moving " & Item.Subject & " to junk
mail folder."
End If
Next x
End Sub
it I get the warning about the script trying to access
email addresses stored in outlook, it then askes do I
want to allow this, if I click yes the script runs as it
should, if no then the item.body call fails.
my question is why are the contacts searched or accessed
when i try to only get the body of a message? and is
there anyway to stop this message from coming up?
perhaps by getting access to the item.body another way?
I'm using XP, Outlook 2003, VS.NET installed, outlook
security level set to very high, my script is self signed
and in the trusted pubs list in outlook.
script is below
Sub FilterZeroBodyMail()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set inbox = myNameSpace.GetDefaultFolder(6)
Set junk = myNameSpace.Folders("Personal
Folders").Folders("Junk E-mail")
intMessCount = inbox.Items.Count
'myFolder.Folders.Get("
For x = 1 To intMessCount
Set Item = inbox.Items(x)
Body = Item.Body ' <--- warning pops up here
Body = Replace(Body, vbCrLf, "")
If Len(Trim(Body)) < 2 Then
Item.Move (junk)
MsgBox "Moving " & Item.Subject & " to junk
mail folder."
End If
Next x
End Sub